Branch: refs/heads/add_ci_builders Author: Enrico Tröger enrico.troeger@uvena.de Committer: Enrico Tröger enrico.troeger@uvena.de Date: Sun, 16 Oct 2022 13:52:46 UTC Commit: 38abbcc1f4998c434d87f667a8204e2ecacb3c22 https://github.com/geany/infrastructure/commit/38abbcc1f4998c434d87f667a8204...
Log Message: ----------- Move Geany and Geany-Plugins specific build scripts
Modified Paths: -------------- builders/README.md builders/scripts/build_mingw64_geany.sh builders/scripts/build_mingw64_geany_plugins.sh builders/start_build.sh
Modified: builders/README.md 11 lines changed, 6 insertions(+), 5 deletions(-) =================================================================== @@ -4,7 +4,7 @@ CI / Nightly-Builders ## About
Scripts and Dockerfiles for Geany and Geany-Plugins nightly builds. -`start_nightly_build.sh` will create (if missing) Docker images for +`start_build.sh` will create (if missing) Docker images for Debian stable and unstable as well as a Docker image for Mingw-w64 cross-compilaton to Windows. For the created Debian packages repositories for the distributions @@ -32,8 +32,6 @@ For the created Debian packages repositories for the distributions ├── scripts -> Build scripts to be executed within Docker containers │ ├── build_debian_geany.sh -> Build Geany Debian packages │ ├── build_debian_geany_plugins.sh -> Build Geany-Plugins Debian packages - │ ├── build_mingw64_geany.sh -> Build Geany Windows installer - │ ├── build_mingw64_geany_plugins.sh -> Build Geany-Plugins Windows installer │ └── update_debian_repositories.sh -> Build repositories for Debian packages │ └── start_build.sh -> Run Debian and Windows build containers and start builds @@ -57,7 +55,9 @@ the builds of Geany and Geany-Plugins for the various targets. can be specified multiple times -f, --force-rebuild Force rebuilding of immages even if not necessary -g, --geany Build Geany + --geany-script Path to the script to be executed to build Geany --geany-source Path to a Geany source directory (optional, cloned from GIT if missing) + --geany-plugins-script Path to the script to be executed to build Geany-Plugins --geany-plugins-source Path to a Geany-Plugins source directory (optional, cloned from GIT if missing) -h Show this help screen -l, --log-to-stdout Log build output additionally to stdout @@ -114,7 +114,8 @@ runtime with all necessary dependencies. The created installer for Geany-Plugins will contain all necessary dependencies for the plugins to work.
-For more details, see the scripts `build_mingw64_geany.sh` and `build_mingw64_geany_plugins.sh` +For more details, see the scripts `scripts/ci_mingw64_geany.sh` and `build/ci_mingw64_geany_plugins.sh` +in the Geany resp. Geany-Plugins repository.
In theory, it is also possible to create release installers with this method.
@@ -126,7 +127,7 @@ Pacman package manager to install packages from the MSYS2 repositories.
### Code sign certificate
-If the directory `certificates` contains the two files `cert.pem` and `key.pem `, +If the directory `certificates` contains the two files `cert.pem` and `key.pem`, then they will be used to digitally sign all created binary files (all built `.exe` and `.dll` files).
Modified: builders/scripts/build_mingw64_geany.sh 327 lines changed, 0 insertions(+), 327 deletions(-) =================================================================== @@ -1,327 +0,0 @@ -#!/bin/bash -# -# Copyright 2022 The Geany contributors -# License: GPLv2 -# -# Helper script to build Geany for Windows in a Docker container. -# The following steps are performed: -# - clone Geany repository if necessary (i.e. if it is not bind-mounted into the container) -# - cross-compile Geany for Windows 64bit and GTK3 -# - sign all binaries and installer (if /certificates exist and contains cert.pem and key.pem) -# - download Geany-Themes for bundling -# - create GTK3 bundle with all dependencies (including grep and sort) -# - create the NSIS installer in ${OUTPUT_DIRECTORY} -# - test the created NSIS installer and compiled Geany -# - test uninstaller and check there is nothing left after uninstalling -# -# This script has to be executed within the Docker container. -# The Docker container should have a bind-mount for ${OUTPUT_DIRECTORY} -# where the resulting installer binary is stored. -# -# To test the installer and Geany binary "wine" is used. -# Please note that we need to use wine32 and wine64 as the -# created installer and uninstaller binaries are 32bit whereas the created -# Geany binary is 64bit. -# - -GEANY_VERSION= # will be set below from configure.ac -GEANY_GIT_REVISION= # will be set below from configure.ac -OUTPUT_DIRECTORY="/output" -GEANY_GIT_REPOSITORY="https://github.com/geany/geany.git" -GEANY_THEMES_REPOSITORY="https://github.com/geany/geany-themes.git" - -# rather static values, unlikely to be changed -GTK_BUNDLE_DIR="/build/gtk-bundle" -GEANY_SOURCE_DIR="/geany-source" -GEANY_BUILD_DIR="/build/geany-build" -GEANY_RELEASE_DIR="/build/geany-release" -GEANY_INSTALLER_FILENAME= # will be set below -GEANY_INSTALLATION_DIR_WIN="C:\geany_install" -GEANY_INSTALLATION_DIR=$(winepath --unix ${GEANY_INSTALLATION_DIR_WIN}) -GEANY_THEMES_DIR="/build/geany-themes" -GEANY_RELEASE_BINARY_PATTERNS=( - "${GEANY_RELEASE_DIR}/bin/geany.exe" - "${GEANY_RELEASE_DIR}/bin/*.dll" - "${GEANY_RELEASE_DIR}/lib/geany/*.dll" -) -GEANY_RELEASE_TEXTFILE_PATTERNS=( - "${GEANY_RELEASE_DIR}/*.txt" - "${GEANY_RELEASE_DIR}/share/doc/geany/*" -) - -# CI CFLAGS -CFLAGS="\ - -Wall \ - -Wextra \ - -O2 \ - -Wunused \ - -Wno-unused-parameter \ - -Wunreachable-code \ - -Wformat=2 \ - -Wundef \ - -Wpointer-arith \ - -Wwrite-strings \ - -Waggregate-return \ - -Wmissing-prototypes \ - -Wmissing-declarations \ - -Wmissing-noreturn \ - -Wmissing-format-attribute \ - -Wredundant-decls \ - -Wnested-externs \ - -Wno-deprecated-declarations" - -# cross-compilation environment -ARCH="x86_64" -MINGW_ARCH="mingw64" -HOST="x86_64-w64-mingw32" -export CC="/usr/bin/${HOST}-gcc" -export CPP="/usr/bin/${HOST}-cpp" -export CXX="/usr/bin/${HOST}-g++" -export AR="/usr/bin/${HOST}-ar" -export STRIP="/usr/bin/${HOST}-strip" -export WINDRES="/usr/bin/${HOST}-windres" -export CFLAGS="-I/windows/${MINGW_ARCH}/include/ ${CFLAGS}" -export LDFLAGS="-static-libgcc ${LDFLAGS}" -export PKG_CONFIG_SYSROOT_DIR="/windows" -export PKG_CONFIG_PATH="/windows/${MINGW_ARCH}/lib/pkgconfig/" -export PKG_CONFIG="/usr/bin/pkg-config" -export NOCONFIGURE=1 - -# stop on errors -set -e - - -log() { - echo "=========== $(date '+%Y-%m-%d %H:%M:%S %Z') $* ===========" -} - - -git_clone_geany_if_necessary() { - if [ -d ${GEANY_SOURCE_DIR} ]; then - log "Copying Geany source" - cp --archive ${GEANY_SOURCE_DIR}/ ${GEANY_BUILD_DIR}/ - else - log "Cloning Geany repository from ${GEANY_GIT_REPOSITORY}" - git clone --depth 1 ${GEANY_GIT_REPOSITORY} ${GEANY_BUILD_DIR} - fi -} - - -parse_geany_version() { - GEANY_VERSION=$(sed -n -E -e 's/^AC_INIT.[Geany], [(.+)],/\1/p' ${GEANY_BUILD_DIR}/configure.ac) - GEANY_GIT_REVISION=$(cd ${GEANY_BUILD_DIR} && git rev-parse --short --revs-only HEAD 2>/dev/null || true) - TIMESTAMP=$(date +%Y%m%d%H%M%S) - # add pull request number if this is a CI and a PR build - if [ "${GITHUB_PULL_REQUEST}" ]; then - GEANY_VERSION="${GEANY_VERSION}_ci_${TIMESTAMP}_${GEANY_GIT_REVISION}_pr${GITHUB_PULL_REQUEST}" - elif [ "${CI}" -a "${GEANY_GIT_REVISION}" ]; then - GEANY_VERSION="${GEANY_VERSION}_ci_${TIMESTAMP}_${GEANY_GIT_REVISION}" - elif [ "${GEANY_GIT_REVISION}" ]; then - GEANY_VERSION="${GEANY_VERSION}_git_${TIMESTAMP}_${GEANY_GIT_REVISION}" - fi - GEANY_INSTALLER_FILENAME="geany-${GEANY_VERSION}_setup.exe" -} - - -log_environment() { - log "Using environment" - CONFIGURE_OPTIONS="--disable-silent-rules --host=${HOST} --prefix=${GEANY_RELEASE_DIR} --with-libiconv-prefix=/windows/mingw64" - echo "Geany version : ${GEANY_VERSION}" - echo "Geany GIT revision : ${GEANY_GIT_REVISION}" - echo "PATH : ${PATH}" - echo "HOST : ${HOST}" - echo "CC : ${CC}" - echo "CFLAGS : ${CFLAGS}" - echo "Configure : ${CONFIGURE_OPTIONS}" -} - - -patch_version_information() { - log "Patching version information" - - if [ -z "${GEANY_GIT_REVISION}" ] && [ -z "${CI}" ]; then - return - fi - - # parse version string and decrement the patch and/or minor levels to keep nightly build - # versions below the next release version - regex='^([0-9]*)[.]([0-9]*)([.]([0-9]*))?' - if [[ ${GEANY_VERSION} =~ $regex ]]; then - MAJOR="${BASH_REMATCH[1]}" - MINOR="${BASH_REMATCH[2]}" - PATCH="${BASH_REMATCH[4]}" - if [ -z "${PATCH}" ] || [ "${PATCH}" = "0" ]; then - MINOR="$((MINOR-1))" - PATCH="90" - else - PATCH="$((PATCH-1))" - fi - else - echo "Could not extract or parse version tag" >&2 - exit 1 - fi - # replace version information in configure.ac and for Windows binaries - sed -i -E "s/^AC_INIT.[Geany], [(.+)],/AC_INIT([Geany], [${GEANY_VERSION}],/" ${GEANY_BUILD_DIR}/configure.ac - sed -i -E "s/^#define VER_FILEVERSION_STR[[:space:]]+".*"+/#define VER_FILEVERSION_STR "${GEANY_VERSION}"/" ${GEANY_BUILD_DIR}/geany_private.rc - sed -i -E "s/^#define VER_FILEVERSION[[:space:]]+[0-9,]+/#define VER_FILEVERSION ${MAJOR},${MINOR},${PATCH},90/" ${GEANY_BUILD_DIR}/geany_private.rc - sed -i -E "s/^[[:space:]]+version="[0-9.]+"/version="${MAJOR}.${MINOR}.${PATCH}.90"/" ${GEANY_BUILD_DIR}/geany.exe.manifest - sed -i -E "s/^!define PRODUCT_VERSION "@VERSION@"/!define PRODUCT_VERSION "${GEANY_VERSION}"/" ${GEANY_BUILD_DIR}/geany.nsi.in - sed -i -E "s/^!define PRODUCT_VERSION_ID "@VERSION@.0.0"/!define PRODUCT_VERSION_ID "${MAJOR}.${MINOR}.${PATCH}.90"/" ${GEANY_BUILD_DIR}/geany.nsi.in -} - - -build_geany() { - cd ${GEANY_BUILD_DIR} - log "Running autogen.sh" - ./autogen.sh - log "Running configure" - ./configure ${CONFIGURE_OPTIONS} - log "Running make" - make - log "Running install-strip" - make install-strip - - cd / -} - - -sign_file() { - echo "Sign file $1" - if [ -f /certificates/cert.pem ] && [ -f /certificates/key.pem ]; then - osslsigncode sign \ - -certs /certificates/cert.pem \ - -key /certificates/key.pem \ - -n "Geany Binary" \ - -i "https://www.geany.org/" \ - -ts http://zeitstempel.dfn.de/ \ - -h sha512 \ - -in ${1} \ - -out ${1}-signed - mv ${1}-signed ${1} - else - echo "Skip signing due to missing certificate" - fi -} - - -sign_geany_binaries() { - log "Signing Geany binary files" - for binary_file_pattern in ${GEANY_RELEASE_BINARY_PATTERNS[@]}; do - for binary_file in $(ls ${binary_file_pattern}); do - sign_file ${binary_file} - done - done -} - - -convert_text_files_to_crlf() { - log "Converting line endings to CRLF in text files" - for text_file_pattern in ${GEANY_RELEASE_TEXTFILE_PATTERNS[@]}; do - for text_file in $(ls ${text_file_pattern}); do - mime_type=$(file --brief --mime-type ${text_file}) - case $mime_type in text/*) - unix2dos ${text_file} - esac - done - done -} - - -create_gtk_bundle() { - log "Creating GTK bundle" - mkdir ${GTK_BUNDLE_DIR} - cd ${GTK_BUNDLE_DIR} - bash ${GEANY_BUILD_DIR}/scripts/gtk-bundle-from-msys2.sh -x -3 - cd / -} - - -fetch_geany_themes() { - log "Cloning Geany-Themes repository from ${GEANY_THEMES_REPOSITORY}" - git clone --depth 1 ${GEANY_THEMES_REPOSITORY} ${GEANY_THEMES_DIR} -} - - -create_installer() { - log "Creating NSIS installer" - makensis \ - -V3 \ - -WX \ - -DGEANY_INSTALLER_NAME="${GEANY_INSTALLER_FILENAME}" \ - -DGEANY_RELEASE_DIR=${GEANY_RELEASE_DIR} \ - -DGEANY_THEMES_DIR=${GEANY_THEMES_DIR} \ - -DGTK_BUNDLE_DIR=${GTK_BUNDLE_DIR} \ - ${GEANY_BUILD_DIR}/geany.nsi -} - - -sign_installer() { - log "Signing NSIS installer" - sign_file ${GEANY_BUILD_DIR}/${GEANY_INSTALLER_FILENAME} -} - - -test_installer() { - log "Test NSIS installer" - exiftool -FileName -FileType -FileVersion -FileVersionNumber ${GEANY_BUILD_DIR}/${GEANY_INSTALLER_FILENAME} - # install Geany: perform a silent install and check for installed files - mingw-w64-i686-wine ${GEANY_BUILD_DIR}/${GEANY_INSTALLER_FILENAME} /S /D=${GEANY_INSTALLATION_DIR_WIN} - # check if we have something installed - test -f ${GEANY_INSTALLATION_DIR}/uninst.exe || exit 1 - test -f ${GEANY_INSTALLATION_DIR}/bin/geany.exe || exit 1 - test -f ${GEANY_INSTALLATION_DIR}/lib/geany/export.dll || exit 1 - test ! -f ${GEANY_INSTALLATION_DIR}/lib/geany/demoplugin.dll || exit 1 -} - - -log_geany_version() { - log "Log installed Geany version" - mingw-w64-x86_64-wine ${GEANY_INSTALLATION_DIR}/bin/geany.exe --version 2>/dev/null - exiftool -FileName -FileType -FileVersion -FileVersionNumber ${GEANY_INSTALLATION_DIR}/bin/geany.exe -} - - -test_uninstaller() { - log "Test NSIS uninstaller" - # uninstall Geany and test if everything is clean - mingw-w64-i686-wine ${GEANY_INSTALLATION_DIR}/uninst.exe /S - sleep 10 # it seems the uninstaller returns earlier than the files are actually removed, so wait a moment - test ! -e ${GEANY_INSTALLATION_DIR} -} - - -copy_installer_and_bundle() { - log "Copying NSIS installer and GTK bundle" - cp ${GEANY_BUILD_DIR}/${GEANY_INSTALLER_FILENAME} ${OUTPUT_DIRECTORY} - cd ${GTK_BUNDLE_DIR} - zip --quiet --recurse-paths ${OUTPUT_DIRECTORY}/gtk_bundle_$(date '+%Y%m%dT%H%M%S').zip * - cd / -} - - -main() { - git_clone_geany_if_necessary - - parse_geany_version - log_environment - patch_version_information - build_geany - sign_geany_binaries - convert_text_files_to_crlf - - create_gtk_bundle - fetch_geany_themes - create_installer - sign_installer - - test_installer - log_geany_version - test_uninstaller - - copy_installer_and_bundle - - log "Done." -} - - -main
Modified: builders/scripts/build_mingw64_geany_plugins.sh 357 lines changed, 0 insertions(+), 357 deletions(-) =================================================================== @@ -1,357 +0,0 @@ -#!/bin/bash -# -# Copyright 2022 The Geany contributors -# License: GPLv2 -# -# Helper script to build Geany-Plugins for Windows in a Docker container. -# The following steps are performed: -# - clone Geany-Plugins repository if necessary (i.e. if it is not bind-mounted into the container) -# - cross-compile Geany-Plugins for Windows 64bit and GTK3 -# - sign all binaries and installer (if /certificates exist and contains cert.pem and key.pem) -# - create bundle with all dependencies -# - create the NSIS installer in ${OUTPUT_DIRECTORY} -# - test the created NSIS installer -# - test uninstaller and check there is nothing unexpected left after uninstalling -# -# This script has to be executed within the Docker container. -# The Docker container should have a bind-mount for ${OUTPUT_DIRECTORY} -# where the resulting installer binary is stored. -# -# To test the installer "wine" is used. -# Please note that we need to use wine32 as the created installer and uninstaller -# binaries are 32bit. -# - -GEANY_PLUGINS_VERSION= # will be set below from configure.ac -GEANY_PLUGINS_GIT_REVISION= # will be set below -OUTPUT_DIRECTORY="/output" -GEANY_PLUGINS_GIT_REPOSITORY="https://github.com/geany/geany-plugins.git" - -# rather static values, unlikely to be changed -DEPENDENCY_BUNDLE_DIR="/build/dependencies-bundle" -GEANY_PLUGINS_SOURCE_DIR="/geany-plugins-source" -GEANY_PLUGINS_BUILD_DIR="/build/geany-plugins-build" -GEANY_PLUGINS_RELEASE_DIR="/build/geany-plugins-release" -GEANY_PLUGINS_INSTALLER_FILENAME= # will be set below -GEANY_PLUGINS_INSTALLATION_DIR_WIN="C:\geany_plugins_install" -GEANY_PLUGINS_INSTALLATION_DIR=$(winepath --unix ${GEANY_PLUGINS_INSTALLATION_DIR_WIN}) -GEANY_PLUGINS_RELEASE_BINARY_PATTERNS=( - "${GEANY_PLUGINS_RELEASE_DIR}/lib/geany/*.dll" - "${GEANY_PLUGINS_RELEASE_DIR}/lib/geany-plugins/geanylua/libgeanylua.dll" - "${GEANY_PLUGINS_RELEASE_DIR}/bin/libgeanypluginutils*.dll" -) - -GEANY_PLUGINS_RELEASE_TEXTFILE_PATTERNS=( - "${GEANY_PLUGINS_RELEASE_DIR}/share/doc/geany-plugins/*" - "${GEANY_PLUGINS_RELEASE_DIR}/share/doc/geany-plugins/*/*" -) -GEANY_INSTALLATION_DIR="/root/.wine/drive_c/geany_install" - -GEANY_INSTALL_DIR_WIN=$(winepath --windows ${GEANY_INSTALLATION_DIR}) -GEANY_INSTALLER_EXECUTABLE=$(ls ${OUTPUT_DIRECTORY}/geany-*_setup.exe) - -# TODO move to include and use it also in Geany build script -# CI CFLAGS -CFLAGS="\ - -Wall \ - -Wextra \ - -O2 \ - -Wunused \ - -Wno-unused-parameter \ - -Wunreachable-code \ - -Wformat=2 \ - -Wundef \ - -Wpointer-arith \ - -Wwrite-strings \ - -Waggregate-return \ - -Wmissing-prototypes \ - -Wmissing-declarations \ - -Wmissing-noreturn \ - -Wmissing-format-attribute \ - -Wredundant-decls \ - -Wnested-externs \ - -Wno-deprecated-declarations" - -# cross-compilation environment -ARCH="x86_64" -MINGW_ARCH="mingw64" -HOST="x86_64-w64-mingw32" -export CC="/usr/bin/${HOST}-gcc" -export CPP="/usr/bin/${HOST}-cpp" -export CXX="/usr/bin/${HOST}-g++" -export AR="/usr/bin/${HOST}-ar" -export STRIP="/usr/bin/${HOST}-strip" -export WINDRES="/usr/bin/${HOST}-windres" -export CFLAGS="-I/windows/${MINGW_ARCH}/include/ ${CFLAGS}" -export LDFLAGS="-static-libgcc ${LDFLAGS}" -export PKG_CONFIG_SYSROOT_DIR="/windows" -export PKG_CONFIG_PATH="/windows/${MINGW_ARCH}/lib/pkgconfig/" -export PKG_CONFIG="/usr/bin/pkg-config" -export PATH="${PATH}:/windows/mingw64/bin" -export NOCONFIGURE=1 - -# stop on errors -set -e - - -log() { - echo "=========== $(date '+%Y-%m-%d %H:%M:%S %Z') $* ===========" -} - - -git_clone_geany_plugins_if_necessary() { - if [ -d ${GEANY_PLUGINS_SOURCE_DIR} ]; then - log "Copying Geany-Plugins source" - cp --archive ${GEANY_PLUGINS_SOURCE_DIR}/ ${GEANY_PLUGINS_BUILD_DIR}/ - else - log "Cloning Geany-Plugins repository from ${GEANY_PLUGINS_GIT_REPOSITORY}" - git clone --depth 1 ${GEANY_PLUGINS_GIT_REPOSITORY} ${GEANY_PLUGINS_BUILD_DIR} - fi -} - - -parse_geany_plugins_version() { - GEANY_PLUGINS_VERSION=$(sed -n -E -e 's/^AC_INIT.[geany-plugins], [(.+)]./\1/p' ${GEANY_PLUGINS_BUILD_DIR}/configure.ac) - GEANY_PLUGINS_GIT_REVISION=$(cd ${GEANY_PLUGINS_BUILD_DIR} && git rev-parse --short --revs-only HEAD 2>/dev/null || true) - TIMESTAMP=$(date +%Y%m%d%H%M%S) - # add pull request number if this is a CI and a PR build - if [ "${GITHUB_PULL_REQUEST}" ]; then - GEANY_PLUGINS_VERSION="${GEANY_PLUGINS_VERSION}_ci_${TIMESTAMP}_${GEANY_PLUGINS_GIT_REVISION}_pr${GITHUB_PULL_REQUEST}" - elif [ "${CI}" -a "${GEANY_PLUGINS_GIT_REVISION}" ]; then - GEANY_PLUGINS_VERSION="${GEANY_PLUGINS_VERSION}_ci_${TIMESTAMP}_${GEANY_PLUGINS_GIT_REVISION}" - elif [ "${GEANY_PLUGINS_GIT_REVISION}" ]; then - GEANY_PLUGINS_VERSION="${GEANY_PLUGINS_VERSION}_git_${TIMESTAMP}_${GEANY_PLUGINS_GIT_REVISION}" - fi - GEANY_PLUGINS_INSTALLER_FILENAME="geany-plugins-${GEANY_PLUGINS_VERSION}_setup.exe" -} - - -log_environment() { - log "Using environment" - CONFIGURE_OPTIONS="--disable-silent-rules --host=${HOST} --prefix=${GEANY_PLUGINS_RELEASE_DIR} --with-geany-libdir=${GEANY_PLUGINS_RELEASE_DIR}/lib" - echo "Geany-Plugins version : ${GEANY_PLUGINS_VERSION}" - echo "Geany-Plugins GIT revision : ${GEANY_PLUGINS_GIT_REVISION}" - echo "Geany installer : ${GEANY_INSTALLER_EXECUTABLE}" - echo "PATH : ${PATH}" - echo "HOST : ${HOST}" - echo "CC : ${CC}" - echo "CFLAGS : ${CFLAGS}" - echo "Configure : ${CONFIGURE_OPTIONS}" -} - - -patch_version_information() { - log "Patching version information" - - if [ -z "${GEANY_PLUGINS_GIT_REVISION}" ]; then - return - fi - - # parse version string and decrement the patch and/or minor levels to keep nightly build - # versions below the next release version - regex='^([0-9]*)[.]([0-9]*)([.]([0-9]*))?' - if [[ ${GEANY_PLUGINS_VERSION} =~ $regex ]]; then - MAJOR="${BASH_REMATCH[1]}" - MINOR="${BASH_REMATCH[2]}" - PATCH="${BASH_REMATCH[4]}" - if [ -z "${PATCH}" ] || [ "${PATCH}" = "0" ]; then - MINOR="$((MINOR-1))" - PATCH="90" - else - PATCH="$((PATCH-1))" - fi - else - echo "Could not extract or parse version tag" >&2 - exit 1 - fi - # replace version information in configure.ac and for Windows binaries - sed -i -E "s/^AC_INIT.[geany-plugins], [(.+)],/AC_INIT([geany-plugins], [${GEANY_PLUGINS_VERSION}],/" ${GEANY_PLUGINS_BUILD_DIR}/configure.ac - sed -i -E "s/^!define PRODUCT_VERSION "(.+)"/!define PRODUCT_VERSION "${GEANY_PLUGINS_VERSION}"/" ${GEANY_PLUGINS_BUILD_DIR}/build/geany-plugins.nsi - sed -i -E "s/^!define PRODUCT_VERSION_ID "(.+)"/!define PRODUCT_VERSION_ID "${MAJOR}.${MINOR}.${PATCH}.90"/" ${GEANY_PLUGINS_BUILD_DIR}/build/geany-plugins.nsi - sed -i -E "s/^!define REQUIRED_GEANY_VERSION "(.+)"/!define REQUIRED_GEANY_VERSION "${MAJOR}.${MINOR}"/" ${GEANY_PLUGINS_BUILD_DIR}/build/geany-plugins.nsi -} - - -install_dependencies() { - log "Installing build dependencies" - pacman --noconfirm -Syu - pacman --noconfirm -S \ - mingw-w64-${ARCH}-check \ - mingw-w64-${ARCH}-cppcheck \ - mingw-w64-${ARCH}-ctpl-git \ - mingw-w64-${ARCH}-enchant \ - mingw-w64-${ARCH}-gpgme \ - mingw-w64-${ARCH}-gtkspell3 \ - mingw-w64-${ARCH}-libgit2 \ - mingw-w64-${ARCH}-libsoup \ - mingw-w64-${ARCH}-lua51 -} - - -install_geany() { - log "Installing Geany (using wine)" - if [ -z "${GEANY_INSTALLER_EXECUTABLE}" -o ! -f "${GEANY_INSTALLER_EXECUTABLE}" ]; then - echo "No Geany installer found" - exit 1 - fi - mingw-w64-i686-wine ${GEANY_INSTALLER_EXECUTABLE} /S /D=${GEANY_INSTALL_DIR_WIN} - - # TODO the following steps are way too hacky: installing Geany from the installer is basically - # what we want for CI tests but the installed "geany.pc" file isn't really suitable - # for cross-compiling - - # add the Geany installation directory to the PKG_CONFIG_PATH - export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${GEANY_INSTALLATION_DIR}/lib/pkgconfig/" - # patch Geany pkg-config prefix: pkg-config always prepend "/windows" to the "prefix" variable, so we - # need to add ../ to get out of the hardcoded "/windows" path element - sed -i "s%^(prefix=).*$%\1/..${GEANY_INSTALLATION_DIR}%" ${GEANY_INSTALLATION_DIR}/lib/pkgconfig/geany.pc - sed -i "s%^(exec_prefix=).*$%\1/..${GEANY_INSTALLATION_DIR}%" ${GEANY_INSTALLATION_DIR}/lib/pkgconfig/geany.pc - # we need "${exec_prefix}/bin" additionally for libgeany-0.dll which is installed into bin/ and replace -lgeany by -lgeany-0 - sed -i "s%^Libs: -L${libdir} -lgeany$%Libs: -L${libdir} -L${exec_prefix}/bin -lgeany-0%" ${GEANY_INSTALLATION_DIR}/lib/pkgconfig/geany.pc -} - - -build_geany_plugins() { - cd ${GEANY_PLUGINS_BUILD_DIR} - log "Running autogen.sh" - ./autogen.sh - log "Running configure" - ./configure ${CONFIGURE_OPTIONS} - log "Running make" - make - log "Running install-strip" - make install-strip - - cd / -} - - -sign_file() { - echo "Sign file $1" - if [ -f /certificates/cert.pem ] && [ -f /certificates/key.pem ]; then - osslsigncode sign \ - -certs /certificates/cert.pem \ - -key /certificates/key.pem \ - -n "Geany-Plugins Binary" \ - -i "https://www.geany.org/" \ - -ts http://zeitstempel.dfn.de/ \ - -h sha512 \ - -in ${1} \ - -out ${1}-signed - mv ${1}-signed ${1} - else - echo "Skip signing due to missing certificate" - fi -} - - -sign_geany_plugins_binaries() { - log "Signing Geany-Plugins binary files" - for binary_file_pattern in ${GEANY_PLUGINS_RELEASE_BINARY_PATTERNS[@]}; do - for binary_file in $(ls ${binary_file_pattern}); do - sign_file ${binary_file} - done - done -} - - -convert_text_files_to_crlf() { - log "Converting line endings to CRLF in text files" - for text_file_pattern in ${GEANY_PLUGINS_RELEASE_TEXTFILE_PATTERNS[@]}; do - for text_file in $(ls ${text_file_pattern}); do - mime_type=$(file --brief --mime-type ${text_file}) - case $mime_type in text/*) - unix2dos ${text_file} - esac - done - done -} - - -create_dependencies_bundle() { - log "Creating Geany-Plugins dependencies bundle" - mkdir ${DEPENDENCY_BUNDLE_DIR} - cd ${DEPENDENCY_BUNDLE_DIR} - bash ${GEANY_PLUGINS_BUILD_DIR}/build/gtk-bundle-from-msys2.sh -x -3 - cd / -} - - -create_installer() { - log "Creating NSIS installer" - makensis \ - -V3 \ - -WX \ - -DGEANY_PLUGINS_INSTALLER_NAME="${GEANY_PLUGINS_INSTALLER_FILENAME}" \ - -DGEANY_PLUGINS_RELEASE_DIR=${GEANY_PLUGINS_RELEASE_DIR} \ - -DDEPENDENCY_BUNDLE_DIR=${DEPENDENCY_BUNDLE_DIR} \ - ${GEANY_PLUGINS_BUILD_DIR}/build/geany-plugins.nsi -} - - -sign_installer() { - log "Signing NSIS installer" - sign_file ${GEANY_PLUGINS_BUILD_DIR}/build/${GEANY_PLUGINS_INSTALLER_FILENAME} -} - - -test_installer() { - log "Test NSIS installer" - # perform a silent install and check for installed files - exiftool -FileName -FileType -FileVersion -FileVersionNumber ${GEANY_PLUGINS_BUILD_DIR}/build/${GEANY_PLUGINS_INSTALLER_FILENAME} - # install Geany-Plugins - mingw-w64-i686-wine ${GEANY_PLUGINS_BUILD_DIR}/build/${GEANY_PLUGINS_INSTALLER_FILENAME} /S /D=${GEANY_PLUGINS_INSTALLATION_DIR_WIN} - # check if we have something installed - ls -l ${GEANY_PLUGINS_INSTALLATION_DIR}/uninst-plugins.exe || exit 1 - ls -l ${GEANY_PLUGINS_INSTALLATION_DIR}/lib/geany/addons.dll || exit 1 -} - - -test_uninstaller() { - log "Test NSIS uninstaller" - # uninstall Geany-Plugins and test if everything is clean - mingw-w64-i686-wine ${GEANY_PLUGINS_INSTALLATION_DIR}/uninst-plugins.exe /S - sleep 15 # it seems the uninstaller returns earlier than the files are actually removed, so wait a moment - rest=$(find ${GEANY_PLUGINS_INSTALLATION_DIR} ( -path '*share/locale' -o -path '*share/licenses' ) -prune -false -o -true -printf '%P ') - if [ "${rest}" != " share share/locale share/licenses " ]; then - # do not treat this as error, it might happen if upstream dependencies have been updated, - # the list of files to be removed needs to be updated only before releases - echo "WARNING: Uninstaller failed to uninstall the following files files: ${rest}" - fi -} - - -copy_installer_and_bundle() { - log "Copying NSIS installer and dependencies bundle" - cp ${GEANY_PLUGINS_BUILD_DIR}/build/${GEANY_PLUGINS_INSTALLER_FILENAME} ${OUTPUT_DIRECTORY} - cd ${DEPENDENCY_BUNDLE_DIR} - zip --quiet --recurse-paths ${OUTPUT_DIRECTORY}/geany_plugins_dependencies_bundle_$(date '+%Y%m%dT%H%M%S').zip * - cd / -} - - -main() { - git_clone_geany_plugins_if_necessary - - parse_geany_plugins_version - log_environment - patch_version_information - install_dependencies - install_geany - build_geany_plugins - sign_geany_plugins_binaries - convert_text_files_to_crlf - - create_dependencies_bundle - create_installer - sign_installer - copy_installer_and_bundle - - test_installer - test_uninstaller - - log "Done." -} - - -main
Modified: builders/start_build.sh 18 lines changed, 16 insertions(+), 2 deletions(-) =================================================================== @@ -33,7 +33,9 @@ GNUPG_KEYID=${GNUPG_KEYID:-0EE5B5AD}
BASE_OUTPUT_DIRECTORY="${PWD}/output/" DOCKER_CMD="docker" +GEANY_BUILD_SCRIPT=/geany-source/scripts/ci_mingw64_geany.sh GEANY_SOURCE= +GEANY_PLUGINS_BUILD_SCRIPT=/geany-plugins-source/build/ci_mingw64_geany_plugins.sh GEANY_PLUGINS_SOURCE=
# stop on errors @@ -165,7 +167,7 @@ build_mingw64() { --volume "${PWD}/certificates/:/certificates/" \ --volume "${MINGW64_OUTPUT_DIRECTORY}:/output/" \ "${IMAGE_NAME_WINDOWS}:latest" \ - bash /scripts/build_mingw64_geany.sh + bash ${GEANY_BUILD_SCRIPT} fi
# Build Geany-Plugins @@ -186,7 +188,7 @@ build_mingw64() { --volume "${PWD}/certificates/:/certificates/" \ --volume "${MINGW64_OUTPUT_DIRECTORY}:/output/" \ "${IMAGE_NAME_WINDOWS}:latest" \ - bash /scripts/build_mingw64_geany_plugins.sh + bash ${GEANY_PLUGINS_BUILD_SCRIPT} fi }
@@ -197,7 +199,9 @@ usage() { echo " -d, --distro DISTRO Build for target Debian DISTRO (e.g. "bullseye"," echo " can be specified multiple times" echo " -g, --geany Build Geany" + echo "--geany-script Path to the script to be executed to build Geany" echo "--geany-source Path to a Geany source directory (optional, cloned from GIT if missing)" + echo "--geany-plugins-script Path to the script to be executed to build Geany-Plugins" echo "--geany-plugins-source Path to a Geany-Plugins source directory (optional, cloned from GIT if missing)" echo " -h Show this help screen" echo " -l, --log-to-stdout Log build output additionally to stdout" @@ -229,11 +233,21 @@ parse_command_line_options() { DO_GEANY=1 shift ;; + --geany-script) + GEANY_BUILD_SCRIPT="${2}" + shift + shift + ;; --geany-source) GEANY_SOURCE="${2}" shift shift ;; + --geany-plugins-script) + GEANY_PLUGINS_BUILD_SCRIPT="${2}" + shift + shift + ;; --geany-plugins-source) GEANY_PLUGINS_SOURCE="${2}" shift
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).