Skip to content

Commit

Permalink
Static desktop-file-validate and zsyncmake (#47)
Browse files Browse the repository at this point in the history
* Add install-static-desktop-file-validate.sh

* Build latest desktop-file-utils statically with meson

---------

Co-authored-by: TheAssassin <[email protected]>
  • Loading branch information
probonopd and TheAssassin authored Dec 8, 2024
1 parent d870d4f commit ad50c02
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ci/build-in-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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<lib> in Libs.private
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
39 changes: 39 additions & 0 deletions ci/install-static-desktop-file-validate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#! /bin/bash

set -euxo pipefail

if [[ "${1:-}" == "" ]]; then
echo "Usage: $0 <version>"
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
38 changes: 38 additions & 0 deletions ci/install-static-zsyncmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#! /bin/bash

set -euxo pipefail

if [[ "${1:-}" == "" ]]; then
echo "Usage: $0 <version>"
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

0 comments on commit ad50c02

Please sign in to comment.