首页 > 系统相关 >Compile NSIS scripts in Linux

Compile NSIS scripts in Linux

时间:2023-05-23 18:03:03浏览次数:61  
标签:2.46 nsis makensis Compile NSIS Linux alejandro home


http://blog.alejandrocelaya.com/2014/02/01/compile-nsis-scripts-in-linux/

 

Compile NSIS scripts in Linux



NSIS is a well known system used to create Windows installers for any type of application based on scripts.

It is good system. Once we have defined our script we can automatically build it to create application installers in minutes, including creation of Windows register entries, installation folders, application shortcuts, etc

The problem is that only Windows binaries are officially provided to compile this kind of scripts. This can be a problem in a continuous integration environment, where continuous integration servers use to be Linux based.

At this article I am going to explain how to compile NSIS source code in Linux to get it working there and allow it to be invoked from automated tasks run in a continuous integration server.

Download NSIS

The first step is to download the windows distributable zip file and the source code. Both of them can be downloaded from their Sourceforge project: https://sourceforge.net/projects/nsis/files/?source=navbar.

At the moment of writing this article the last stable version is NSIS 2.46, so we will need to download nsis-2.46.zip and nsis-2.46-src.tar.bz2. We will put them in a folder were users who are going to need it are allowed to access. I am going to put it at /home/alejandro/nsis

Now that we have downloaded both windwos distributable package and source code we are going to decompress them creating two folders, nsis-2.46 and nsis-2.46-src.

System requirements

NSIS official documentation says we need this tools to compile it:

  • Python, version 1.6 or higher. I am using Python 2.7.3
  • Scons version 0.96.93 or higher. This application can be downloaded from their official website http://www.scons.org/download.php
  • A C compiler, in our case gcc and g++

All of this tools can be easily installed from repository, and probably we already have some of them.

The scons installer downloaded from their website comes in RPM format which could be a problem for systems not based in Ubuntu. For Debian I used the alien [aptitude install alien] tool, which converts RPM packages into DEB packages by running this command: alien -k filename.rpm

Anyway, I uploaded the DEB resultant package for you to download it.

Compile NSIS

Once all the requirements are clear we are going to compile the NSIS binary that is responsible for interpreting the scripts, the so called makensis.

We have to be at the source code directory, in my case /home/alejandro/nsis/nsis-2.46-src, and we execute this command.

scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all NSIS_CONFIG_CONST_DATA=no PREFIX=/path/where/distributable/was/extracted install-compiler

Notice that install-compiler is an argument of the command that is placed at the end, and is not part of the distributable path.

In my case, using my real path, the resulting command would be this:

scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all NSIS_CONFIG_CONST_DATA=no PREFIX=/home/alejandro/nsis/nsis-2.46 install-compiler

The execution of this command will compile the code, generating the makensis binary at the bin directory inside the distributable package folder, in my case /home/alejandro/nsis/nsis-2.46/bin.

Test makensis and create an installer

Now that we have makensis created its a good idea to make it available from anywhere, for example adding it to a bin directory, and make sure it can be executed.

Using the paths from our example, running this commands will make the job.

chmod +x /home/alejandro/nsis/nsis-2.46/bin/makensis
ln -s /home/alejandro/nsis/nsis-2.46/bin/makensis /usr/local/bin/makensis

Now it is time to test the command. Running makensis from anywhere should output something like this.

Compile NSIS scripts in Linux_php

If we have an nsis script, runing the command makensis /path/to/script.nsi will compile the script, creating the installer. The syntax is the same used in windows.

Atention! While running this command there could be this error.

Error: opening stub "/home/alejandro/nsis/nsis-2.46/share/nsis/Stubs/zlib
Error initalizing CEXEBuild: error setting default stub

This could happen because of a path error, but solving it is very simple, just go to the NSIS distributable folder, /home/alejandro/nsis/nsis-2.46 in my case, and create the folder share [mkdir share], go to that folder an create a symbolic link running ln -s /home/alejandro/nsis/nsis-2.46 nsis.

That should fix the problem.

With this easy steps we have now a NSIS compilation system under a Linux machine ready to build and deploy Windows installers.

标签:2.46,nsis,makensis,Compile,NSIS,Linux,alejandro,home
From: https://blog.51cto.com/u_16125990/6333879

相关文章

  • Linux开发
    shell命令概述Shell作用:命令解释器介于操作系统内核与用户之间,负责解释命令行获得命令帮助内部命令help命令的“--help”选项使用man命令阅读手册页命令行编辑的几个辅助操作Tab键:自动补齐反斜杠“\”:强制换行快捷键Ctrl+U:清空至行首快捷键Ctrl+K:清空至行尾快捷键Ctr......
  • Windows 11 和 Rocky 9 Linux 平台 MySQL 8.0.33 简易安装教程
    目录Windows平台安装MySQLLinux平台Rocky9安装MySQLbinarypackagerpmpackageyum源sourcepackageWindows11和Rocky9Linux初体验MySQL8.0.33简易安装教程。MySQL8.0目前最新稳定版本已经更新到了MySQL8.0.33,估计下一个稳定版本(大约在今年7月份)推出。当然,......
  • linux ssh远程登录
    目录一、ssh概念二、配置文件三、ssh组成结构四、远程控制过程五、远程复制 六、配置密钥七、wraooers防火墙          一、ssh概念 ssh:一种安全通道协议功能:1.实现字符界面远程登录2.远程复制3.ssh协议是对通......
  • Linux 挂载安装文件
    先安装后挂载1先用./configure--prefix=/usr/local/YOUR_FOLDERmake&&makeinstall安装至指定目录,方便管理2编写可执行程序、库等文件的挂载和卸载脚本SRCDIR="/usr/local/libpng"DSTDIR="/usr/local"BIN_FILE_0=bin/libpng16-configBIN_FILE_1=bin/pngfixBIN_FI......
  • Linux文件权限
    Linux的安全性Linux安全系统的核心是用户账户。每个能访问Linux系统的用户都会被分配一个唯一的用户账户。用户权限是通过创建用户时分配的用户ID(userID,UID)来跟踪的。用户在登录系统时是使用登录名(loginname)来代替UID登录的登录名是用户用来登录系统的最长8字符的字符串(字......
  • Linux下安装MySQL
    安装环境:虚拟机virtualbox,Ubuntu20.04系统;命令行下输入:sudoaptupdatesudoapt-getinstallmysql-server等待安装完成后,输入命令进行配置;sudomysql_secure_installation是否对密码验证组件进行配置?y密码强度?0root新密码?your_password 是否继续?y 遇到这个问......
  • Linux查找文件内容的常用命令方法
    1.从文件内容查找匹配指定字符串的行###grep字符串filenameeg:grep2019on.log2. 从文件内容查找与正则表达式匹配的行  grep-e正则表达式 filename3.查找时不区分大小写 grep-i字符串 filename4.查找匹配的行数  grep-c字符串filenam......
  • linux FTP文本传输
    目录一、文本传输协议二、连接方式三、程序安装四、黑名单和白名单五、实验1.实验一:匿名用户下载与上传2.实验二:关闭匿名用户登录,允许普通用户登录在家目录上传和下载3.实验三:禁止用户切换目录,只能在家目录操作4.实验四:黑名单限制test1登录   5.......
  • linux内核升级
    linux内核升级所有节点升级系统并重启(线上环境必须升级)yumupdate-y--exclude=kernel*wgethttp://193.49.22.109/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-devel-4.19.12-1.el7.elrepo.x86_64.rpmwgethttp://193.49.22.109/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-4.1......
  • linux 格式化磁盘为xfs格式 chatgpt问答
    问:linux格式化磁盘为xfs格式答:要将磁盘格式化为XFS格式,可以按照以下步骤进行操作:确保已连接要格式化的磁盘,并获取磁盘的设备名称(例如,/dev/sdb)。在终端中以管理员权限登录到Linux系统。运行以下命令来安装XFS工具(如果尚未安装):sqlCopycodesudoaptupdatesu......