Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 25 additions & 79 deletions binaries/fish/static.official.source.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
_disabled: false

pkg: "fish"
pkg_id: "github.com.fish-shell.fish-shell.source"
pkg_id: "github.com.fish-shell.fish-shell"
pkg_type: "static"
category:
- "ConsoleOnly"
Expand Down Expand Up @@ -40,94 +40,40 @@ note:
- "Built From Source (Latest Git HEAD). Check/Report @ https://github.com/fish-shell/fish-shell"
provides:
- "fish"
- "fish_indent"
- "fish_key_reader"
repology:
- "fish"
src_url:
- "https://github.com/fish-shell/fish-shell"
tag:
- "Utility"
x_exec:
bsys: "docker://rust"
bsys: "host://soar-dl"
host:
- "aarch64-Linux"
- "riscv64-Linux"
- "x86_64-Linux"
shell: "bash"
pkgver: |
pushd "$(mktemp -d)" &>/dev/null && \
git clone --depth="1" --filter="blob:none" --no-checkout --single-branch --quiet "https://github.com/fish-shell/fish-shell" "./TEMPREPO" &>/dev/null && \
git --git-dir="./TEMPREPO/.git" --no-pager log -1 --pretty=format:'HEAD-%h-%cd' --date=format:'%y%m%dT%H%M%S' && \
[ -d "$(realpath .)/TEMPREPO" ] && rm -rf "$(realpath .)" &>/dev/null && popd &>/dev/null
curl -qfsSL "https://api.gh.pkgforge.dev/repos/fish-shell/fish-shell/releases?per_page=100" | jq -r '[.[] | select(.draft == false)] | .[0].tag_name | gsub("\\s+"; "")' | tr -d '"'\''[:space:]'
run: |
#Build
mkdir -pv "${SBUILD_TMPDIR}/tmp" && docker run --privileged --net="host" --name "alpine-builder" --pull="always" \
-e "PKG=${PKG}" -e "PKG_ID=${PKG_ID}" -e "PKG_TYPE=${PKG_TYPE}" -e "PKG_VER=${PKG_VER}" \
-e "PKGVER=${PKGVER}" -e "SBUILD_PKG=${SBUILD_PKG}" -e "SBUILD_PKGVER=${SBUILD_PKGVER}" \
--volume "${SBUILD_TMPDIR}/tmp:/tmp:rw" \
"ghcr.io/pkgforge/devscripts/alpine-builder:$(uname -m)" \
bash -l -c '
#Setup ENV
set -x ; mkdir -p "/build-bins" && pushd "$(mktemp -d)" &>/dev/null
[[ -s "${HOME}/.cargo/env" ]] && source "${HOME}/.cargo/env"
if [[ "$(uname -m | tr -d '[:space:]')" == "riscv64" ]]; then
RUST_TARGET="$(rustc -Vv 2>/dev/null | sed -n "s/^[[:space:]]*host[[:space:]]*:[[:space:]]*//p" | grep -i "riscv" | tr -d "[:space:]")"
if [[ -n "${RUST_TARGET//[[:space:]]/}" ]]; then
export RUST_TARGET
else
rustc -Vv ; exit 1
fi
else
rustup default nightly
rustup component add rust-src --toolchain nightly
export RUST_TARGET="$(uname -m)-unknown-linux-musl"
rustup target add "${RUST_TARGET}"
fi
RUST_FLAGS=()
RUST_FLAGS+=("-C target-feature=+crt-static")
RUST_FLAGS+=("-C default-linker-libraries=yes")
if echo "${RUST_TARGET}" | grep -Eqiv "alpine|gnu"; then
RUST_FLAGS+=("-C link-self-contained=yes")
fi
RUST_FLAGS+=("-C prefer-dynamic=no")
RUST_FLAGS+=("-C embed-bitcode=yes")
RUST_FLAGS+=("-C lto=yes")
RUST_FLAGS+=("-C opt-level=z")
RUST_FLAGS+=("-C debuginfo=none")
RUST_FLAGS+=("-C strip=symbols")
RUST_FLAGS+=("-C linker=clang")
RUST_FLAGS+=("-C link-arg=-fuse-ld=$(which mold)")
RUST_FLAGS+=("-C link-arg=-Wl,--Bstatic")
RUST_FLAGS+=("-C link-arg=-Wl,--static")
RUST_FLAGS+=("-C link-arg=-Wl,-S")
RUST_FLAGS+=("-C link-arg=-Wl,--build-id=none")
export RUSTFLAGS="${RUST_FLAGS[*]}"
#Build
git clone --filter "blob:none" --quiet "https://github.com/fish-shell/fish-shell" "./TEMPREPO" && cd "./TEMPREPO/"
echo -e "\n[+] Target: ${RUST_TARGET}"
echo -e "[+] Flags: ${RUSTFLAGS}\n"
sed "/^\[profile\.release\]/,/^$/d" -i "./Cargo.toml" ; echo -e "\n[profile.release]\nstrip = true\nopt-level = 3\nlto = true" >> "./Cargo.toml"
rm -rvf "./.cargo" rust-toolchain* 2>/dev/null
cargo build --workspace --target "${RUST_TARGET}" \
--all-features \
--jobs="$(($(nproc)+1))" \
--release \
--keep-going \
--verbose
find -L "./target/${RUST_TARGET}/release" -maxdepth 1 -type f 2>/dev/null
#Copy
find "./target/${RUST_TARGET}/release" -maxdepth 1 -type f -exec file -i "{}" \; | grep -Ei "application/.*executable|inode/symlink|text/x-perl|text/.*script" | cut -d":" -f1 | xargs realpath --no-symlinks | xargs -I "{}" rsync -achvL "{}" "/build-bins/"
( askalono --format "json" crawl --follow "$(realpath .)" | jq -r ".. | objects | .path? // empty" | head -n 1 | xargs -I "{}" cp -fv "{}" "/build-bins/LICENSE" ) 2>/dev/null
#Strip
find "/build-bins/" -type f -exec objcopy --remove-section=".comment" --remove-section=".note.*" "{}" \;
find "/build-bins/" -type f ! -name "*.no_strip" -exec strip --strip-all --verbose "{}" 2>/dev/null \;
find "/build-bins/" -type f -exec bash -c "echo && realpath {} && readelf --section-headers {} 2>/dev/null" \;
file "/build-bins/"* && stat -c "%n: %s Bytes" "/build-bins/"* && \
du "/build-bins/"* --bytes --human-readable --time --time-style="full-iso" --summarize
popd &>/dev/null
'
#Copy & Meta
docker cp "alpine-builder:/build-bins/." "${SBUILD_TMPDIR}/"
[ -s "${SBUILD_TMPDIR}/LICENSE" ] && cp -fv "${SBUILD_TMPDIR}/LICENSE" "${SBUILD_OUTDIR}/LICENSE"
find "${SBUILD_TMPDIR}" -maxdepth 1 -type f -exec file -i "{}" \; | grep -Ei "application/.*executable|inode/symlink|text/x-perl|text/.*script" | cut -d":" -f1 | xargs realpath --no-symlinks | xargs -I "{}" rsync -achvL "{}" "${SBUILD_OUTDIR}"
#Download
case "$(uname -m)" in
aarch64)
soar dl "https://github.com/fish-shell/fish-shell@${PKGVER}" --match "linux,aarch64,musl,tar" --exclude "amd64,x86,x64,sha256,sha512,bsd,macos,windows" -o "${SBUILD_TMPDIR}/${PKG}.archive" --yes
;;
x86_64)
soar dl "https://github.com/fish-shell/fish-shell@${PKGVER}" --match "linux,x86_64,musl,tar" --exclude "aarch,arm,i386,i686,sha256,sha512,bsd,macos,windows" -o "${SBUILD_TMPDIR}/${PKG}.archive" --yes
;;
esac
#Extract
while E_X=$(find "${SBUILD_TMPDIR}" -type f -exec file -i "{}" + |
grep -Ei "archive|compressed|gzip|x-compress|x-tar" |
grep -iv "application/.*executable" |
cut -d: -f1 | head -n1); [ -n "${E_X}" ]
do
7z e "${E_X}" -o"${SBUILD_TMPDIR}/." -y && {
file -i "${E_X}" | grep -q "application/.*executable" && break
rm -f "${E_X}"
} || break
done
#Copy
find "${SBUILD_TMPDIR}" -maxdepth 1 -type f -exec file -i "{}" \; | grep -Ei "application/.*executable|inode/symlink|text/x-perl|text/.*script" | cut -d":" -f1 | xargs realpath --no-symlinks | xargs -I "{}" rsync -achvL "{}" "${SBUILD_OUTDIR}/${PKG}"