Branch: refs/heads/master Author: Enrico Tröger enrico.troeger@uvena.de Committer: Enrico Tröger enrico.troeger@uvena.de Date: Sat, 04 Sep 2021 11:30:46 UTC Commit: 51ee8d14eba40dbf8f3d2359a9bad216aa5905f4 https://github.com/geany/geany-plugins/commit/51ee8d14eba40dbf8f3d2359a9bad2...
Log Message: ----------- Windows: Create GTK bundle for x86_64 and support non-native execution
Changes in the bundle creation script: - the GTK (and other dependencies) bundle is now created for the x86_64 platform - the new parameter "-x" allows to run script on a Linux system using Wine, therefore it is necessary to run the post-install scripts after all packages have been extracted. - use "-Sdd" for Pacman to ignore dependencies as we resolve them manually - do not use "tar -x --xz" as Pacman nowadays also downloads .zst packages, instead just download the file and let tar choose the format automatically based on the filename - replace GTK2 by (upcoming) GTK4 in bundle script - ignore package signatures on bundle creation - ignore Pacman cache on bundle creation
Modified Paths: -------------- build/gtk-bundle-from-msys2.sh
Modified: build/gtk-bundle-from-msys2.sh 101 lines changed, 72 insertions(+), 29 deletions(-) =================================================================== @@ -6,10 +6,15 @@ # shell. The extracted files will be placed into the current # directory.
-ABI=i686 +ABI=x86_64 # do not change, i686 is not supported any longer use_cache="no" make_zip="no" gtkv="3" +run_pi="y" +cross="no" + +# Wine commands for 64bit binaries, used only when "-x" is set +EXE_WRAPPER_64="mingw-w64-x86_64-wine"
# ctags - binary for GeanyCTags plugin # ctpl-git - for GeanyGenDoc plugin @@ -78,15 +83,10 @@ termcap xz "
-gtk2_dependency_pkgs=" -gtkspell -webkitgtk2 -" gtk3_dependency_pkgs=" gtkspell3 -webkitgtk3 " - +gtk4_dependency_pkgs="" package_urls=""
@@ -99,20 +99,28 @@ handle_command_line_options() { "-z"|"--zip") make_zip="yes" ;; - "-2") - gtkv="2" - ;; "-3") gtkv="3" ;; + "-4") + gtkv="4" + ;; + "-n") + run_pi="" + ;; + "-x") + cross="yes" + ;; "-h"|"--help") - echo "gtk-bundle-from-msys2.sh [-c] [-h] [-z] [-2 | -3] [CACHEDIR]" + echo "gtk-bundle-from-msys2.sh [-c] [-h] [-z] [-3 | -4] [-x] [CACHEDIR]" echo " -c Use pacman cache. Otherwise pacman will download" echo " archive files" echo " -h Show this help screen" + echo " -n Do not run post install scripts of the packages" echo " -z Create a zip afterwards" - echo " -2 Prefer gtk2" echo " -3 Prefer gtk3" + echo " -4 Prefer gtk4" + echo " -x Set when the script is executed in a cross-compilation context (e.g. to use wine)" echo "CACHEDIR Directory where to look for cached packages (default: /var/cache/pacman/pkg)" exit 1 ;; @@ -123,6 +131,10 @@ handle_command_line_options() { done }
+set -e # stop on errors +# enable extended globbing as we need it in _getpkg +shopt -s extglob + initialize() { if [ -z "$cachedir" ]; then cachedir="/var/cache/pacman/pkg" @@ -133,6 +145,11 @@ initialize() { exit 1 fi
+ if [ "$cross" != "yes" ]; then + # if running natively, we do not need wine or any other wrappers + EXE_WRAPPER_64="" + fi + gtk="gtk$gtkv" eval "gtk_dependency_pkgs=${${gtk}_dependency_pkgs}"
@@ -142,23 +159,26 @@ ${gtk_dependency_pkgs} " }
-_remember_package_source() { +_getpkg() { if [ "$use_cache" = "yes" ]; then - package_url=`pacman -Sp mingw-w64-${ABI}-${2}` + package_info=$(pacman -Qi mingw-w64-$ABI-$1) + package_version=$(echo "$package_info" | grep "^Version " | cut -d':' -f 2 | tr -d '[[:space:]]') + # use @(gz|xz|zst) to filter out signature files (e.g. mingw-w64-x86_64-...-any.pkg.tar.zst.sig) + ls $cachedir/mingw-w64-${ABI}-${1}-${package_version}-*.tar.@(gz|xz|zst) | sort -V | tail -n 1 else - package_url="${1}" + # -dd to ignore dependencies as we listed them already above in $packages and + # make pacman ignore its possibly existing cache (otherwise we would get an URL to the cache) + pacman -Sddp --cachedir /nonexistent mingw-w64-${ABI}-${1} fi - package_urls="${package_urls}\n${package_url}" }
-_getpkg() { +_remember_package_source() { if [ "$use_cache" = "yes" ]; then - package_info=`pacman -Qi mingw-w64-$ABI-$1` - package_version=`echo "$package_info" | grep "^Version " | cut -d':' -f 2 | tr -d '[[:space:]]'` - ls $cachedir/mingw-w64-${ABI}-${1}-${package_version}-* | sort -V | tail -n 1 + package_url=$(pacman -Sddp mingw-w64-${ABI}-${2}) else - pacman -Sp mingw-w64-${ABI}-${1} + package_url="${1}" fi + package_urls="${package_urls}\n${package_url}" }
extract_packages() { @@ -179,28 +199,50 @@ extract_packages() { fi else echo "Download $pkg using curl" - curl -L "$pkg" | tar -x --xz + filename=$(basename "$pkg") + curl -s -o "$filename" -L "$pkg" + tar xf "$filename" + rm "$filename" fi - if [ -f .INSTALL ]; then - echo "Running post_install script for "$i"" - /bin/bash -c ". .INSTALL; post_install" + if [ "$make_zip" = "yes" -a "$i" = "$gtk" ]; then + VERSION=$(grep ^pkgver .PKGINFO | sed -e 's,^pkgver = ,,' -e 's,-.*$,,') fi rm -f .INSTALL .MTREE .PKGINFO .BUILDINFO done }
move_extracted_files() { echo "Move extracted data to destination directory" - if [ -d mingw32 ]; then + if [ -d mingw64 ]; then for d in bin etc home include lib libexec locale sbin share ssl var; do - if [ -d "mingw32/$d" ]; then + if [ -d "mingw64/$d" ]; then rm -rf $d # prevent sporadic 'permission denied' errors on my system, not sure why they happen sleep 0.5 - mv mingw32/$d . + mv mingw64/$d . fi done - rmdir mingw32 + rmdir mingw64 + fi +} + +delayed_post_install() { + if [ "$run_pi" ]; then + echo "Execute delayed post install tasks" + # Commands have been collected manually from the various .INSTALL scripts + + # ca-certificates + DEST=etc/pki/ca-trust/extracted + # OpenSSL PEM bundle that includes trust flags + ${EXE_WRAPPER_64} bin/p11-kit extract --format=openssl-bundle --filter=certificates --overwrite $DEST/openssl/ca-bundle.trust.crt + ${EXE_WRAPPER_64} bin/p11-kit extract --format=pem-bundle --filter=ca-anchors --overwrite --purpose server-auth $DEST/pem/tls-ca-bundle.pem + ${EXE_WRAPPER_64} bin/p11-kit extract --format=pem-bundle --filter=ca-anchors --overwrite --purpose email $DEST/pem/email-ca-bundle.pem + ${EXE_WRAPPER_64} bin/p11-kit extract --format=pem-bundle --filter=ca-anchors --overwrite --purpose code-signing $DEST/pem/objsign-ca-bundle.pem + ${EXE_WRAPPER_64} bin/p11-kit extract --format=java-cacerts --filter=ca-anchors --overwrite --purpose server-auth $DEST/java/cacerts + mkdir -p ssl/certs + cp -f $DEST/pem/tls-ca-bundle.pem ssl/certs/ca-bundle.crt + cp -f $DEST/pem/tls-ca-bundle.pem ssl/cert.pem + cp -f $DEST/openssl/ca-bundle.trust.crt ssl/certs/ca-bundle.trust.crt fi }
@@ -304,6 +346,7 @@ handle_command_line_options $@ initialize extract_packages move_extracted_files +delayed_post_install cleanup_unnecessary_files create_bundle_dependency_info_file create_zip_archive
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
plugins-commits@lists.geany.org