Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static desktop-file-validate and zsyncmake #47

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
4 changes: 3 additions & 1 deletion ci/build-in-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ 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
Expand All @@ -77,7 +77,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 56d220dd679c7c3a8f995a41a27a7d6f3df49dea
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
46 changes: 46 additions & 0 deletions ci/install-static-desktop-file-validate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#! /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
probonopd marked this conversation as resolved.
Show resolved Hide resolved
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-*/
# The next 2 lines are a workaround for: checking build system type... ./config.guess: unable to guess system type
wget 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' -O config.guess
wget 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' -O config.sub
autoreconf --install # https://github.com/shendurelab/LACHESIS/issues/31#issuecomment-283963819
./configure CFLAGS=-no-pie LDFLAGS=-static

if [[ "${GITHUB_ACTIONS:-}" != "" ]]; then
jobs="$(nproc)"
else
jobs="$(nproc --ignore=1)"
fi

make -j"$jobs"

# TODO: Find more elegant way to do this
cd src/
gcc -static -o desktop-file-validate keyfileutils.o validate.o validator.o mimeutils.o -lglib-2.0 -lintl
strip desktop-file-validate
cp desktop-file-validate /usr/bin/
cd ..
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
Loading