From 6ed25f26baf57115f8907966b0e170cef55f2a81 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 27 Oct 2024 14:10:34 -0400 Subject: Add initial setup --- bin/build | 27 +++++++++++++++++++++++++++ bin/check | 34 ++++++++++++++++++++++++++++++++++ bin/package | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100755 bin/build create mode 100755 bin/check create mode 100755 bin/package (limited to 'bin') diff --git a/bin/build b/bin/build new file mode 100755 index 0000000..63cfe97 --- /dev/null +++ b/bin/build @@ -0,0 +1,27 @@ +#!/bin/sh +# SPDX-License-Identifier: 0BSD + +set -eu + +img=${1?"usage: $0 "} + +test -f git-annex/git-annex.cabal || { + printf >&2 'initialize git-annex submodule first\n' + exit 1 +} +test -z "$(git -C git-annex status --porcelain -unormal)" || { + printf >&2 'git-annex repository is dirty\n' + exit 1 +} +test -n "$(git -C git-annex for-each-ref --points-at=HEAD refs/tags)" || { + printf >&2 'git-annex repository must be on a tagged commit\n' + exit 1 +} + +git -C git-annex clean -xfd +podman run \ + -v ./git-annex:/git-annex \ + -v ./img-scripts:/mnt \ + -w /git-annex \ + --env RELEASE_BUILD=1 --rm \ + "$img" /mnt/build diff --git a/bin/check b/bin/check new file mode 100755 index 0000000..fc1b75b --- /dev/null +++ b/bin/check @@ -0,0 +1,34 @@ +#!/bin/sh +# SPDX-License-Identifier: 0BSD + +set -eu + +version=${1?"usage: $0 "} + +tgz=builds/git-annex-$version-linux-amd64.tar.gz +test -f "$tgz" || { + printf >&2 'file does not exist: %s\n' "$tgz" + exit 2 +} + +tdir=$(mktemp -d "${TMPDIR:-/tmp}"/static-annex-XXXXXXX) +tar xzf "$tgz" -C "$tdir" +cd "$tdir/git-annex-$version" + +if ldd bin/git-annex 2>/dev/null +then + printf >&2 'ldd unexpectedly had 0 exit status on bin/git-annex\n' + ldd bin/git-annex + exit 1 +fi + +PATH=$(pwd)/bin:$PATH +export PATH + +base=${tdir##*/} +command -v git-annex | grep -qF "$base" +command -v git-annex-shell | grep -qF "$base" +command -v git-remote-annex | grep -qF "$base" +command -v git-remote-tor-annex | grep -qF "$base" + +git annex test diff --git a/bin/package b/bin/package new file mode 100755 index 0000000..837dfbf --- /dev/null +++ b/bin/package @@ -0,0 +1,41 @@ +#!/bin/sh +# SPDX-License-Identifier: 0BSD + +set -eu + +test $# = 2 || { + cat >&2 <<-EOF +usage: $0 + +Create 'builds/git-annex--linux-amd64.tar.gz' from +files under ./git-annex/, most importantly the git-annex binary under +cabal's build directory for and . +EOF + exit 2 +} + +version_ghc=$1 +version_annex=$2 + +cabal_root=git-annex/dist-newstyle/build/x86_64-linux +binary=$cabal_root/ghc-$version_ghc/git-annex-$version_annex/build/git-annex/git-annex + +pkg_root=builds/git-annex-$version_annex +mkdir -p "$pkg_root" + +pkg_bin=$pkg_root/bin +mkdir "$pkg_bin" +cp "$binary" "$pkg_bin"/ +ln -s git-annex "$pkg_bin"/git-annex-shell +ln -s git-annex "$pkg_bin"/git-remote-annex +ln -s git-annex "$pkg_bin"/git-remote-tor-annex + +cp git-annex/COPYRIGHT "$pkg_root"/ + +pkg_man=$pkg_root/share/man/man1 +mkdir -p "$pkg_man" +cp git-annex/man/*.1 "$pkg_man"/ +gzip -9 "$pkg_man"/*.1 + +tar czf "$pkg_root"-linux-amd64.tar.gz -C builds git-annex-"$version_annex" +rm -r "$pkg_root" -- cgit v1.2.3