From ad50c02724104234a1709baa9e8e9b55a66ba26e Mon Sep 17 00:00:00 2001 From: probonopd Date: Sun, 8 Dec 2024 12:21:39 -0500 Subject: [PATCH] Static desktop-file-validate and zsyncmake (#47) * Add install-static-desktop-file-validate.sh * Build latest desktop-file-utils statically with meson --------- Co-authored-by: TheAssassin --- ci/build-in-docker.sh | 7 ++-- ci/build.sh | 2 ++ ci/install-static-desktop-file-validate.sh | 39 ++++++++++++++++++++++ ci/install-static-zsyncmake.sh | 38 +++++++++++++++++++++ 4 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 ci/install-static-desktop-file-validate.sh create mode 100644 ci/install-static-zsyncmake.sh diff --git a/ci/build-in-docker.sh b/ci/build-in-docker.sh index c56ca03..b237214 100755 --- a/ci/build-in-docker.sh +++ b/ci/build-in-docker.sh @@ -59,10 +59,11 @@ docker run \ set -euxo pipefail -apk add bash git gcc g++ cmake make file desktop-file-utils wget \ +apk add bash git gcc g++ cmake make file wget \ gpgme-dev libgcrypt-dev libgcrypt-static argp-standalone zstd-dev zstd-static util-linux-static \ glib-static libassuan-static zlib-static libgpg-error-static \ - curl-dev curl-static nghttp2-static libidn2-static openssl-libs-static brotli-static c-ares-static libunistring-static + curl-dev curl-static nghttp2-static libidn2-static openssl-libs-static brotli-static c-ares-static libunistring-static \ + glib-static glib-dev autoconf automake meson # libcurl's pkg-config scripts are broken. everywhere, everytime. # these additional flags have been collected from all the .pc files whose libs are mentioned as -l in Libs.private @@ -74,7 +75,9 @@ echo "Requires.private: libcares libnghttp2 libidn2 libssl openssl libcrypto lib # in a Docker container, we can safely disable this check git config --global --add safe.directory '*' +bash -euxo pipefail /source/ci/install-static-desktop-file-validate.sh 0.28 bash -euxo pipefail /source/ci/install-static-mksquashfs.sh 4.6.1 +bash -euxo pipefail /source/ci/install-static-zsyncmake.sh 0.6.2 bash -euxo pipefail /source/ci/build.sh diff --git a/ci/build.sh b/ci/build.sh index e7b06b9..3d62401 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -36,7 +36,9 @@ make install DESTDIR=AppDir find AppDir +cp "$(which desktop-file-validate)" AppDir/usr/bin cp "$(which mksquashfs)" AppDir/usr/bin +cp "$(which zsyncmake)" AppDir/usr/bin cp "$repo_root"/resources/AppRun.sh AppDir/AppRun chmod +x AppDir/AppRun diff --git a/ci/install-static-desktop-file-validate.sh b/ci/install-static-desktop-file-validate.sh new file mode 100644 index 0000000..f64b10e --- /dev/null +++ b/ci/install-static-desktop-file-validate.sh @@ -0,0 +1,39 @@ +#! /bin/bash + +set -euxo pipefail + +if [[ "${1:-}" == "" ]]; then + echo "Usage: $0 " + exit 2 +fi + +version="$1" + +build_dir="$(mktemp -d -t desktop-file-utils-build-XXXXXX)" + +cleanup () { + if [ -d "$build_dir" ]; then + rm -rf "$build_dir" + fi +} +trap cleanup EXIT + +pushd "$build_dir" + +# apk add glib-static glib-dev autoconf automake # Moved to build-in-docker.sh + +wget -c "https://gitlab.freedesktop.org/xdg/desktop-file-utils/-/archive/"$version"/desktop-file-utils-"$version".tar.gz" +tar xf desktop-file-utils-*.tar.gz +cd desktop-file-utils-*/ + +# setting LDFLAGS as suggested in https://mesonbuild.com/Creating-Linux-binaries.html#building-and-installing +env LDFLAGS=-static meson setup build --prefer-static --default-library=static + +if [[ "${GITHUB_ACTIONS:-}" != "" ]]; then + jobs="$(nproc)" +else + jobs="$(nproc --ignore=1)" +fi + +ninja -C build -j "$jobs" -v +ninja -C build -j 1 -v install diff --git a/ci/install-static-zsyncmake.sh b/ci/install-static-zsyncmake.sh new file mode 100644 index 0000000..d4f7449 --- /dev/null +++ b/ci/install-static-zsyncmake.sh @@ -0,0 +1,38 @@ +#! /bin/bash + +set -euxo pipefail + +if [[ "${1:-}" == "" ]]; then + echo "Usage: $0 " + exit 2 +fi + +version="$1" + +build_dir="$(mktemp -d -t zsyncmake-build-XXXXXX)" + +cleanup () { + if [ -d "$build_dir" ]; then + rm -rf "$build_dir" + fi +} +trap cleanup EXIT + +pushd "$build_dir" + +wget http://zsync.moria.org.uk/download/zsync-"$version".tar.bz2 -q +tar xf zsync-*.tar.bz2 + +cd zsync-*/ + +find . -type f -exec sed -i -e 's|off_t|size_t|g' {} \; + +./configure CFLAGS=-no-pie LDFLAGS=-static --prefix=/usr --build=$(arch)-unknown-linux-gnu + +if [[ "${GITHUB_ACTIONS:-}" != "" ]]; then + jobs="$(nproc)" +else + jobs="$(nproc --ignore=1)" +fi + +make -j"$jobs" install \ No newline at end of file