Differences

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

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
howtos:win32:msys2 [2015/05/29 08:54] – created kugelhowtos:win32:msys2 [2019/08/19 19:08] – Add warning not to install gcc and mingw-w64-i686-gcc ntrel
Line 1: Line 1:
  
  
-====== 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. In fact, it's so good it should become the default method of compiling Geany on Windows. 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.
Line 21: Line 19:
  
 Next, execute: Next, execute:
-''pacman --needed -Sy bash pacman pacman-mirrors msys2-runtime''+  pacman --needed -Sy bash pacman pacman-mirrors msys2-runtime
  
 Now exit and re-open the msys2 environment and perform a system update: Now exit and re-open the msys2 environment and perform a system update:
-''pacman -Su''+  pacman -Su 
 + 
 +Restart msys2 once more, in case ''pacman -Su'' updated environment related packages.
  
 Finally, install the dependencies needed by Geany. Finally, install the dependencies needed by Geany.
  
   # toolchain   # toolchain
-  pacman -S pacman -S mingw-w64-i686-binutils mingw-w64-i686-gcc mingw-w64-i686-gdb+  pacman -S mingw-w64-i686-binutils mingw-w64-i686-gcc mingw-w64-i686-gdb
   # make and Autotools   # make and Autotools
   pacman -S make pkgconfig autoconf automake libtool intltool   pacman -S make pkgconfig autoconf automake libtool intltool
   # gtk familiy   # gtk familiy
   pacman -S mingw-w64-i686-gtk2 mingw-w64-i686-gtk3   pacman -S mingw-w64-i686-gtk2 mingw-w64-i686-gtk3
-  # for building html docs+  # for building html docs*
   pacman -S mingw-w64-i686-python2 mingw-w64-i686-python2-docutils   pacman -S mingw-w64-i686-python2 mingw-w64-i686-python2-docutils
   # and if you fancy building from git   # and if you fancy building from git
   pacman -S git   pacman -S git
 +  # necessary for GTK bundle and installer steps
 +  pacman -S rsync
 +  
 +*If you don't install python docutils, you will need to pass ''-''''-disable-html-docs'' to ''configure''
 +
 +Make sure you have not installed both ''gcc'' and ''mingw-w64-i686-gcc'', or you may get errors when building Geany.
      
 At last, you want to add ''C:\msys32\mingw32\bin'' to your PATH environment variable, in order to run Geany from the Windows Explorer. At last, you want to add ''C:\msys32\mingw32\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-i686-check mingw-w64-i686-enchant mingw-w64-i686-lua51 mingw-w64-i686-gpgme mingw-w64-i686-libsoup mingw-w64-i686-libgit2 mingw-w64-i686-gtkspell mingw-w64-i686-webkitgtk2 mingw-w64-i686-webkitgtk3
 +  
  
 ===== GTK+3 compilation ===== ===== GTK+3 compilation =====
  
-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.+This is effectively the same procedure as cross-compiling on Linux. You can either clone the source code from the GIT repository or download a release tarball (1.27 or laterand unpack it.
  
   curl -L -o geany-master.zip https://github.com/geany/geany/archive/master.zip   curl -L -o geany-master.zip https://github.com/geany/geany/archive/master.zip
Line 57: Line 69:
 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. 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.16.3\\+The first run should look like this, on GTK+ 3.18.6\\
 {{:howtos:win32:geany-gtk3.png?&300|}} {{:howtos:win32:geany-gtk3.png?&300|}}
  
 ===== GTK+2 compilation ===== ===== GTK+2 compilation =====
  
-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.+This is effectively the same procedure as cross-compiling on Linux. You can either clone the source code from the GIT repository or download a release tarball (1.27 or laterand unpack it.
  
   curl -L -o geany-master.zip https://github.com/geany/geany/archive/master.zip   curl -L -o geany-master.zip https://github.com/geany/geany/archive/master.zip
Line 76: Line 88:
 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. 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+ 2.24.27 \\+The first run should look like this, on GTK+ 2.24.28 \\
 {{:howtos:win32:geany-gtk2.png?300|}} {{:howtos:win32:geany-gtk2.png?300|}}
  
-===== Creating an installer =====+===== 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 is available at https://raw.githubusercontent.com/geany/geany/master/scripts/gtk-bundle-from-msys2.sh. 
 + 
 +To run it, 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. 
 +Finally it will download the sources for *grep* and then compile *grep*. 
 + 
 +  cd 
 +  curl -L -o geany-gtk-bundle-from-msys2.sh https://raw.githubusercontent.com/geany/geany/master/scripts/gtk-bundle-from-msys2.sh 
 +  mkdir /h/geany-bundle 
 +  cd /h/geany-bundle 
 +  bash ~/geany-gtk-bundle-from-msys2.sh -2 
 +  rsync -a --delete /h/geany-bundle/ ~/geany/gtk/ 
 + 
 +There are a few command line options for this script. Run it with "-h" for details. 
 +The most important option is "-2" and "-3" which defines the GTK version to be used. 
 + 
 +The trailing "rsync" command is only necessary if you intend to create an installer later on. 
 + 
 +==== Geany-Plugins ==== 
 + 
 +For Geany-Plugins, the process is quite similar. 
 +The script for Geany-Plugins is available at https://raw.githubusercontent.com/geany/geany-plugins/master/build/gtk-bundle-from-msys2.sh. 
 + 
 +  cd 
 +  curl -L -o geany-plugins-gtk-bundle-from-msys2.sh https://raw.githubusercontent.com/geany/geany-plugins/master/build/gtk-bundle-from-msys2.sh 
 +  mkdir /h/geany-plugins-bundle 
 +  cd /h/geany-plugins-bundle 
 +  bash ~/geany-plugins-gtk-bundle-from-msys2.sh -2 
 +  rsync -a --delete /h/geany-plugins-bundle/ ~/geany-plugins/contrib/ 
 + 
 +The trailing "rsync" command is only necessary if you intend to create an installer later on. 
 + 
 +===== 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): 
 + 
 +  DESTINATON=/
 +  VERSION="1.29" 
 +  cd ~/geany 
 +  make distclean 
 +  ./autogen.sh 
 +  ./configure --prefix=${DESTINATON}/geany_install --disable-silent-rules 
 +  make -j 2 
 +  make install 
 +  make DESTDIR=${DESTINATON}/geany install 
 +  rsync -a --delete ${DESTINATON}/geany/h/geany_install/ ~/geany/geany-${VERSION}/ 
 + 
 +The used destination here is "/h" which is the MSYS2 way to address H:\. 
 +You can use any other location as installation target. 
 +Then we compile Geany and install it normally and additionally using DESTDIR to 
 +another location. 
 +The normal installation is for Geany-Plugins so they can easily find the Geany installation 
 +while the DESTDIR installation is used to move the installed files into the source directory 
 +back for the installer creation. 
 + 
 +This process can probably be optimized and shortened but for now it works this way. 
 + 
 +The following actually creates the installer. 
 +The installer script expects that you have Python and NSIS 2.x (http://nsis.sourceforge.net/Download) 
 +installed in your normal Windows system (not in MSYS2). In the future, it would be cool to build the 
 +installer from within the MSYS2 environment but currently only NSIS 3.0 Beta is available in MSYS2. 
 + 
 +For the following steps, a little Python 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. 
 + 
 +The script will also use SignCode to add digital signatures to the created binaries and installers. 
 +Either setup a working SignCode installation or comment out the signing calls at the end of the script. 
 + 
 +Finally, start a Windows console session (Start->Run->cmd.exe) and execute: 
 + 
 +  cd c:\msys64\home\<username>\geany 
 +  python ..\geany-release.py 
 + 
 +This will strip and sign all binaries (geany.exe and various .dll files) and 
 +also convert documentation text files to CRLF format. 
 +At the end, you should get two installer executables in ~/geany. 
 + 
 + 
 +==== Geany-Plugins ==== 
 + 
 +Build instructions to build Geany-Plugins in order to create a Windows installer (within MSYS2 shell): 
 + 
 +  DESTINATON=/
 +  VERSION="1.29" 
 +  cd ~/geany-plugins 
 +  make distclean 
 +  ./autogen.sh 
 +  ./configure --prefix=${DESTINATON}/geany_install --with-geany-libdir=${DESTINATON}/geany_install/lib --disable-silent-rules 
 +  make -j 2 
 +  make install 
 +  make DESTDIR=${DESTINATON}/geany-plugins install 
 +  rsync -a --delete ${DESTINATON}/geany-plugins/h/geany_install/ ~/geany-plugins/geany-plugins-${VERSION}/ 
 + 
 +For the following steps, a little Python 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 script will also use SignCode to add digital signatures to the created binaries and installers. 
 +Either setup a working SignCode installation or comment out the signing calls at the end of the script. 
 + 
 +Finally, start a Windows console session (Start->Run->cmd.exe) and execute: 
 + 
 +  cd c:\msys64\home\<username>\geany-plugins 
 +  python ..\geany-plugins-release.py 
 + 
 +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 ~/geany-plugins.
  
-TODO 
  
 ===== Automated build via MAKEPKG file ===== ===== Automated build via MAKEPKG file =====
  
 TODO TODO
 +
 +{{tag>howto win32 build build-from-source}}
Print/export