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
andg++
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.
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.
相关推荐
iperf3 static compile for arm-linux
内核,是一个操作系统的核心。它负责管理系统的进程、内存、设备驱动程序、文件和网络系统,决定着系统的性能和稳定性...本文将以RedHat Linux 6.0(kernel 2.2.5)为操作系统平台,介绍在Linux上进行内核编译的方法。
Linux下的常用shell命令,文本编辑器vi和C语言编译、调试工具gcc、gdb的使用心得。
linux ko compile .zip linux ko compile .zip
本人亲自试验教程可用,该步骤编译centos7系统内核,生成rpm包进行安装,网上试验很多教程在windows虚拟机上编译成功,安装成功,但系统切换新内核以后无法进入系统。 本人试验环境:win10系统 ...
describes how to compile a linux kernel and how to configure the kernel in the booting process
NULL 博文链接:https://pop1030123.iteye.com/blog/1402747
Compile SQLite using the cross-compiler such as arm-linux-gcc first, get sqlite-3.3.6.tar.gz from www.sqlite.org unzip it, #tar -zxvf sqlite-3.3.6.tar.gz change into the sqlite-3.3.6 directory cd ...
compile
Compile Time Regular Expression in C++
带mmu的arm开发,Bootloader 的使用,交叉编译,内核移植等内容
gcc cflag parameter! if you need it ,download it and learn it!
PDF电子书《Compile and Runtime Errors in Java》
linux内核的编译步骤。适用于linux的学习
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- xilinx_zynq_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage -j10 make ...
elasticsearch-head-compile-after.tar.gz+node-v8.1.2-linux-x64.ta
javacompile
very low, the kernel has been able to compile and run, and it already includes the essence of the working principle of Linux. The book first briefly introduced the development history of the Linux ...
Today Linux holds fast as the most rapidly growing segment of the computer market and continues to win over enthusiastic adherents in many application areas. With this increasing support, Linux is ...