Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howtos:win32:msys2 [2015/07/31 22:38] – duplicate pacman -S horihowtos:win32:msys2 [2022/10/16 10:56] (current) – Update MSYS2 build information enrico
Line 1: Line 1:
- 
- 
 ====== Build Geany on Windows (using MSYS2) ====== ====== Build Geany on Windows (using MSYS2) ======
  
-*** UNDER CONSTRUCTION *** +Msys2 is a successor to msys which offers a unix-like environment on Windows combined with a pacman-based package manager. 
- +It's purpose is to simplify win32 compiliations, and it's doing great at that for GTK+ stack and related projects. 
-Msys2 is a successor to msys which offers a unix-like environment on Windows combined with a pacman-based package manager. It's purpose is to simplify win32 compiliations, and it's doing great at that for GTK+ stack and related projects. In fact, it's so good it should become the default method of compiling Geany on Windows.+In fact, it's so good it should become the default method of compiling Geany on Windows.
  
 See http://sourceforge.net/projects/msys2/ and http://msys2.github.io/ See http://sourceforge.net/projects/msys2/ and http://msys2.github.io/
  
-This page aims at showing how to use msys2 to build Geany on Windows, both GTK+2 and GTK+3 versions.+This page aims at showing how to use MSYS2 to build Geany on Windows.
  
-===== One-time Setup =====+===== Initial Setup =====
  
-Download the installer from [[http://msys2.github.io/|here]]Chose the 32bit or 64bit version depending on your Windows version, not whether you target a 32bit or 64bit compilation of Geany (this guide will always compile for 32bit).+Download the installer from https://msys2.github.io/Choose the 32bit or 64bit version depending on your Windows version, 
 +not whether you target a 32bit or 64bit compilation of Geany (this guide will always compile for 64bit).
  
-Run the installer and follow the instructions. In the following we will assume that you installed the 32bit version to C:\mingw32.+Run the installer and follow the instructions. In the following we will assume that you installed the 64bit version to C:\mingw64.
  
-After installation, open the msys2 environment via  +After installation, open the MSYS2 environment via 
-''Start Menu -> All Programs -> MSYS2 32bit -> MinGW-w64 Win32 Shell''+`Start Menu -> All Programs -> MSYS2 64bit -> MSYS2 MinGW x64`
  
 Next, execute: Next, execute:
-  pacman --needed -Sy bash pacman pacman-mirrors msys2-runtime 
  
-Now exit and re-open the msys2 environment and perform a system update: +    pacman --needed -Sy bash pacman pacman-mirrors msys2-runtime 
-  pacman -Su+ 
 +Now exit and re-open the MSYS2 environment and perform a system update: 
 + 
 +    pacman -Su 
 + 
 +Restart msys2 once more, in case `pacman -Su` updated environment related packages. 
 + 
 +Finally, install the dependencies needed by Geany: 
 + 
 +    # toolchain 
 +    pacman -S mingw-w64-x86_64-binutils mingw-w64-x86_64-gcc mingw-w64-x86_64-gdb 
 +    # make and Autotools 
 +    pacman -S make mingw-w64-x86_64-libtool mingw-w64-x86_64-pkgconf autoconf automake gettext 
 +    # gtk family 
 +    pacman -S mingw-w64-x86_64-gtk3 
 +    # for building html docs 
 +    pacman -S mingw-w64-x86_64-python3 mingw-w64-x86_64-python-lxml 
 +    # and if you fancy building from git 
 +    pacman -S git 
 +    # necessary for GTK bundle and installer steps 
 +    pacman -S rsync 
 +    # for GTK bundle creation and release creation 
 +    pacman -S curl tar dos2unix zip unzip mingw-w64-x86_64-osslsigncode mingw-w64-x86_64-nsis 
 + 
 +Make sure you have not installed both `gcc` and `mingw-w64-x86_64-gcc`, or you may get errors when building Geany. 
 + 
 +At last, you might want to add `C:\msys64\mingw64\bin` to your `PATH` environment variable, in order to run Geany from the Windows Explorer. 
 + 
 +In case you want also compile the combined Geany-Plugins collection, you need the following dependencies: 
 + 
 +    # geany-plugins dependencies 
 +    pacman -S mingw-w64-x86_64-check mingw-w64-x86_64-enchant mingw-w64-x86_64-lua51 mingw-w64-x86_64-gpgme mingw-w64-x86_64-libsoup mingw-w64-x86_64-libgit2 mingw-w64-x86_64-gtkspell3 mingw-w64-x86_64-ctpl-git 
 + 
 +Note: Pacman will probably suggest to replace `mingw-w64-x86_64-lua51` by `mingw-w64-x86_64-luajit`. 
 +Deny this suggestion and keep installing `mingw-w64-x86_64-lua51`. 
 +Otherwise building the GeanyLua plugin might and creating a release installer will break. 
 + 
 +===== Geany Compilation ===== 
 + 
 +You can either clone the source code from the GIT repository or download a release tarball and unpack it. 
 + 
 +    cd 
 +    curl -L -o geany-master.zip https://github.com/geany/geany/archive/master.zip 
 +    unzip geany-master.zip 
 +    cd geany-master 
 +    # autogen.sh is not needed for release tarballs! 
 +    NOCONFIGURE=1 ./autogen.sh 
 +    # configure and make take a while, don't panic 
 +    ./configure --prefix=/c/geany 
 +    make -j2 
 +    make install 
 + 
 +After that, you can run Geany either through MSYS2 shell (`/c/geany/bin/geany`) or use the Windows Explorer to locate the executable and run it. 
 + 
 +The first run should look like this, on GTK+ 3.18.6 {{:howtos:win32:geany-gtk3.png?&300|}} 
 + 
 +===== Geany-Plugins Compilation ===== 
 + 
 +You can either clone the source code from the GIT repository or download a release tarball and unpack it. 
 + 
 +    cd 
 +    curl -L -o geany-plugins-master.zip https://github.com/geany/geany-plugins/archive/master.zip 
 +    unzip geany-plugins-master.zip 
 +    cd geany-plugins-master 
 +    # autogen.sh is not needed for release tarballs! 
 +    NOCONFIGURE=1 ./autogen.sh 
 +    # configure and make take a while, don't panic 
 +    ./configure --prefix=/c/geany --with-geany-libdir=/c/geany/lib 
 +    make -j2 
 +    make install 
 + 
 + 
 +===== Creating a GTK runtime bundle ===== 
 + 
 +In order to run Geany and/or create an installer for distribution, you need a GTK runtime environment. 
 +There is simple script which downloads all necessary packages and unpack them in an automated way. 
 + 
 +After you have run the scripts as described below, you should copy the resulting files and directories 
 +all into your Geany installation directory if you want to use it directly for your own Geany 
 +installation. 
 +In case you want to create an installer, leave the directories as they are and read on. 
 + 
 +==== Geany ==== 
 + 
 +The script can be found in `scripts/gtk-bundle-from-msys2.sh` in the Geany source directory. 
 + 
 +To run the script, simply create a new directory where the GTK runtime environment should be 
 +unpacked and change into this directory. 
 +Then call the script and wait a bit. It will download all necessary MSYS2 packages and extract them. 
 + 
 +    cd 
 +    mkdir -p ~/geany_build/bundle/geany-gtk 
 +    cd ~/geany_build/bundle/geany-gtk 
 +    bash ~/geany-master/scripts/gtk-bundle-from-msys2.sh -3 
 + 
 +There are a few command line options for this script. Run it with "-h" for details. 
 +The most important option is "-3" and "-4" which defines the GTK version to be used. 
 + 
 +==== Geany-Plugins ==== 
 + 
 +For Geany-Plugins, the process is quite similar. 
 +The script for Geany-Plugins is available `build/gtk-bundle-from-msys2.sh` in the Geany-Plugins source directory. 
 + 
 +    cd 
 +    mkdir -p ~/geany_build/bundle/geany-plugins-dependencies 
 +    cd ~/geany_build/bundle/geany-plugins-dependencies 
 +    bash ~/geany-plugins-master/build/gtk-bundle-from-msys2.sh -3 
 + 
 +===== Creating an installer / Making a release ===== 
 + 
 +When creating releases, you always should make sure your GIT working tree is clean 
 +and maybe temporarily rename ".git" to make "./configure" think that you don't want 
 +to build a debug release. 
 +Alernatively, download a release source tarball, unpack it and use it to compile Geany 
 +resp. Geany-Plugins. 
 + 
 +==== Geany ==== 
 + 
 +Build instructions to build Geany in order to create a Windows installer (within MSYS2 shell):
  
-Restart msys2 once more, in case ''pacman -Su'' updated environment related packages.+    DESTINATON=$HOME/geany_build 
 +    VERSION="1.39" 
 +    cd ~/geany-master 
 +    make distclean 
 +    ./autogen.sh 
 +    mkdir _build 
 +    cd _build 
 +    ../configure --prefix=${DESTINATON}/build/geany --disable-silent-rules 
 +    make -j 2 
 +    make install 
 +    rm -rf $DESTINATON/release/geany-orig 
 +    rsync -a --delete ${DESTINATON}/build/geany/ $DESTINATON/release/geany-orig
  
-Finally, install the dependencies needed by Geany.+You can use any other location as installation target by adjusting `DESTINATON`. 
 +Then we compile Geany and install it normally.
  
-  # toolchain +The following actually creates the installer.
-  pacman -S mingw-w64-i686-binutils mingw-w64-i686-gcc mingw-w64-i686-gdb +
-  # make and Autotools +
-  pacman -S make pkgconfig autoconf automake libtool intltool +
-  # gtk familiy +
-  pacman -S mingw-w64-i686-gtk2 mingw-w64-i686-gtk3 +
-  # for building html docs +
-  pacman -S mingw-w64-i686-python2 mingw-w64-i686-python2-docutils +
-  # and if you fancy building from git +
-  pacman -S git +
-   +
-At last, you want to add ''C:\msys32\mingw32\bin'' to your PATH environment variable, in order to run Geany from the Windows Explorer.+
  
-===== GTK+3 compilation =====+For the following steps, a little Python script is necessary to automate the further installer creation. 
 +The script can be downloaded here: {{:howtos:win32:geany-release.py.txt|}} 
 +Open the script in your editor of choice and change paths at the beginning of the script as needed.
  
-This is effectively the same procedure as cross-compiling on LinuxFor now (until 1.25), a git clone/export is required as it contains some win32-related autotools fixes.+The script will also use `osslsigncode` to add digital signatures to the created binaries and installers. 
 +Either adjust the paths to the certifcate at the beginning of the script or leave them empty to skip digital signing.
  
-  curl -L -o geany-master.zip https://github.com/geany/geany/archive/master.zip +Finallyrun the script:
-  unzip geany-master.zip +
-  cd geany-master +
-  # autogen.sh is not needed for tarballs! +
-  NOCONFIGURE=1 ./autogen.sh +
-  # configure and make take a whiledon't panic +
-  ./configure --enable-gtk3 --prefix=/c/geany +
-  make -j2 +
-  make install+
  
-After that, you can run Geany either through msys2 shell (''/c/geany/bin/geany'') or use the Windows Explorer to locate the executable and run it.+    python3 ~/geany-release.py
  
-The first run should look like this, on GTK+ 3.16.3\\ +This will strip and sign all binaries (geany.exe and various .dll files) and 
-{{:howtos:win32:geany-gtk3.png?&300|}}+also convert documentation text files to CRLF format. 
 +At the end, you should get an installer executable in `$DESTINATON`.
  
-===== GTK+2 compilation =====+==== Geany-Plugins ====
  
-This is effectively the same procedure as cross-compiling on Linux. For now (until 1.25), a git clone/export is required as it contains some win32-related autotools fixes.+Build instructions to build Geany-Plugins in order to create a Windows installer (within MSYS2 shell):
  
-  curl -L -o geany-master.zip https://github.com/geany/geany/archive/master.zip +    DESTINATON=$HOME/geany_build 
-  unzip geany-master.zip +    VERSION="1.39" 
-  cd geany-master +    cd ~/geany-plugins-master 
-  # autogen.sh is not needed for tarballs! +    make distclean 
-  NOCONFIGURE=1 ./autogen.sh +    ./autogen.sh 
-  # configure and make take a while, don't panic +    mkdir _build 
-  ./configure --prefix=/c/geany +    cd _build 
-  make -j2 +    ../configure --prefix=${DESTINATON}/build/geany --with-geany-libdir=${DESTINATON}/build/geany/lib --disable-silent-rules 
-  make install+    make -j 2 
 +    make DESTDIR=${DESTINATON}/build/geany-plugins install 
 +    rsync -a --delete ${DESTINATON}/build/geany-plugins/${DESTINATON}/build/geany/ $DESTINATON/release/geany-plugins-orig
  
-After thatyou can run Geany either through msys2 shell (''/c/geany/bin/geany'') or use the Windows Explorer to locate the executable and run it.+For the following stepsa little Python script is necessary to automate the further installer creation. 
 +The script can be downloaded here: {{:howtos:win32:geany-plugins-release.py.txt|}} 
 +Open the script in your editor of choice and change paths at the beginning of the script as needed.
  
-The first run should look like this, on GTK+ 2.24.27 \\ +The script will also use `osslsigncode` to add digital signatures to the created binaries and installers
-{{:howtos:win32:geany-gtk2.png?300|}}+Either adjust the paths to the certifcate at the beginning of the script or leave them empty to skip digital signing.
  
-===== Creating an installer =====+Finally, run the script:
  
-TODO+    python3 ~/geany-plugins-release.py
  
-===== Automated build via MAKEPKG file =====+This will strip and sign all binaries (various .dll files) and 
 +also convert documentation text files to CRLF format. 
 +At the end, you should get an installer executable in `$DESTINATON`.
  
-TODO+{{tag>howto windows msys2 build build-from-source}}
  
-{{tag>howto win32 build}} 
Print/export