`

Compile NSIS scripts in Linux

 
阅读更多

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.

Nsis help

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

    "iperf3 static compile for arm-linux"这个标题表明我们将讨论如何在基于ARM架构的Linux系统上对iperf3进行静态编译。 静态编译是将所有依赖的库文件都编译进可执行文件中,使得最终生成的程序不依赖系统环境,...

    compile_Linux_kernel.rar_compile linux kernel_linux 2.2.5_编译内核_进

    内核,是一个操作系统的核心。它负责管理系统的进程、内存、设备驱动程序、文件和网络系统,决定着系统的性能和稳定性...本文将以RedHat Linux 6.0(kernel 2.2.5)为操作系统平台,介绍在Linux上进行内核编译的方法。

    shell-and-vi-compile.rar_linux C语言 shell_linux compile命令_reach4m

    在Linux操作系统中,掌握一些基本的shell命令、文本编辑器如vi的使用,以及C语言的编译和调试技巧是至关重要的。...通过阅读和实践"shell and vi compile.doc"文档,可以进一步深化对这些主题的理解。

    Samsung Galaxy S: Compile CyanogenMod (Linux)

    标题中的“Samsung Galaxy S: Compile CyanogenMod (Linux)”指的是在Linux操作系统上为Samsung Galaxy S手机编译CyanogenMod的过程。CyanogenMod是一种基于Android开源项目的第三方操作系统,它提供更多的自定义...

    linux-内核编译各个选项的含义

    * Kernel .config support:把内核的配置信息编译进内核中,以后可以通过 scripts/extract-ikconfig 脚本来提取这些信息。 * Enable access to .config through /proc/config.gz:允许通过/proc/config.gz 访问内核...

    arm_linux_sqlite.rar_compiler for linux_cross compile_linux sqli

    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

    compile

    compile CFLAG

    gcc cflag parameter! if you need it ,download it and learn it!

    compile_protobuf_protobuf:compile_protobuf_

    标题"compile_protobuf_protobuf:compile_protobuf_"指的是使用protobuf编译器来处理.proto文件的过程。这个过程涉及到将.proto文件编译成特定编程语言(如C++、Java或Python)的源代码,以便在程序中使用protobuf...

    lumit-compile-user-app.rar_linux视频

    【标题】"lumit-compile-user-app.rar_linux视频"是一个与Linux系统相关的学习资源,主要包含一个名为“lumit-compile-user-app.avi”的视频教程和一个名为“www.pudn.com.txt”的文本文件。这个压缩包显然是为了...

    elasticsearch-head-compile-after.tar.gz+node-v8.1.2-linux-x64.ta

    标题中的"elasticsearch-head-compile-after.tar.gz"和"node-v8.1.2-linux-x64.ta"分别指的是两个不同的软件组件。首先,Elasticsearch是一个流行的开源搜索引擎和分析平台,广泛应用于大数据检索、日志分析和实时...

    color-compile - 源码

    例如,如果你在Linux或Unix系统上,可以将`color-compile`脚本复制到`/usr/local/bin`目录下,然后像平常一样运行`gcc`或`g++`,`color-compile`将会自动处理颜色输出。 总之,`color-compile`是一个提高开发效率的...

    linux-ftpd-0.17安装包

    (1) 报错内容:Compiler arm-linux-gcc does not exist or cannot compile C; try another. (2)报错内容:ftpcmd.y:108: error: array type has incomplete element type 4、安装ftpd,将ftpd拷贝到/usr/sbin中,...

    qemu调试arm linux 内核环境搭建.doc

    在编译内核时,确保开启调试选项,并使用`make CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm O=./out_vexpress_3_16 zImage-gdb`生成调试信息。然后,在QEMU启动时添加`-s -S`参数以暂停启动并监听GDB连接: ```bash...

    linux wifi工具hostapd编译方法.doc

    ./config -shared no-asm --prefix=/home/zfj/zhengfengjun/hostapd/openssl-1.0.1i/output --cross-compile-prefix=/opt/fsl-imx-fb/4.9.88-2.0.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/...

    Design Compile 介绍.7z

    《Design Compile 深度解析》 Design Compile是一款由Synopsys公司开发的高级综合工具,广泛应用于集成电路(IC)设计领域。它以其强大的功能和高效的优化能力,为芯片设计者提供了一站式的解决方案,帮助他们将...

Global site tag (gtag.js) - Google Analytics