2023-05-06 11:48:11 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
APP_ID="org.featherwallet.Feather"
|
|
|
|
|
|
|
|
get_store_path() {
|
|
|
|
find gnu/store -maxdepth 1 -type d -name "*$1*" | sort | head -n 1
|
|
|
|
}
|
|
|
|
|
2023-10-06 13:38:54 +00:00
|
|
|
mkdir /tmp-output
|
|
|
|
|
|
|
|
mkdir -p /tmp-output/flatpak
|
|
|
|
cd /tmp-output/flatpak
|
2023-05-06 11:48:11 +00:00
|
|
|
|
|
|
|
# Create build dir
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
|
|
|
|
mkdir export
|
|
|
|
cp -a /feather/contrib/flatpak/share export
|
|
|
|
rm -rf export/share/app-info
|
|
|
|
|
|
|
|
# Copy the metadata file
|
|
|
|
cp /feather/contrib/flatpak/metadata .
|
|
|
|
|
|
|
|
mkdir files
|
|
|
|
cd files
|
|
|
|
|
2023-06-29 18:36:16 +00:00
|
|
|
# Copy flatstart binary
|
|
|
|
cp /feather/contrib/depends/x86_64-linux-gnu/bin/startup .
|
|
|
|
|
2023-06-28 18:23:37 +00:00
|
|
|
# Copy feather binary
|
|
|
|
cp /feather-bin feather
|
2023-06-28 15:30:29 +00:00
|
|
|
|
2023-05-06 11:48:11 +00:00
|
|
|
# Copy metadata
|
|
|
|
cp -a /feather/contrib/flatpak/share .
|
|
|
|
touch --no-dereference --date="@${SOURCE_DATE_EPOCH}" share/metainfo/${APP_ID}.metainfo.xml
|
|
|
|
gzip -c share/metainfo/${APP_ID}.metainfo.xml > share/app-info/xmls/${APP_ID}.xml.gz
|
|
|
|
|
|
|
|
# Extract guix pack
|
|
|
|
tar xf /pack .
|
|
|
|
|
|
|
|
# Get store paths
|
|
|
|
GUIX_PROFILE=$(get_store_path "profile")
|
2023-06-28 15:30:29 +00:00
|
|
|
GUIX_GLIBC=$(get_store_path "glibc")
|
|
|
|
GUIX_FONTCONFIG=$(get_store_path "fontconfig")
|
|
|
|
GUIX_GCC=$(get_store_path "gcc")
|
2023-05-06 11:48:11 +00:00
|
|
|
|
2023-06-28 15:30:29 +00:00
|
|
|
# Patch Feather binary
|
|
|
|
patchelf --set-interpreter "/${GUIX_GLIBC}/lib/ld-linux-x86-64.so.2" feather
|
2023-06-29 14:12:04 +00:00
|
|
|
patchelf --set-rpath "/${GUIX_GLIBC}/lib:/${GUIX_FONTCONFIG}/lib:\$ORIGIN/lib" feather
|
|
|
|
|
|
|
|
# Copy dynamically linked libraries
|
|
|
|
mkdir lib
|
|
|
|
cp "${GUIX_GCC}/lib/libgcc_s.so.1" lib/
|
|
|
|
|
|
|
|
# Remove unneeded store items
|
|
|
|
chmod -R 755 .
|
|
|
|
rm -rf "$(get_store_path "bash-static")"
|
|
|
|
rm -rf "$(get_store_path "bash-minimal")"
|
|
|
|
rm -rf "$(get_store_path "gcc")"
|
|
|
|
rm -rf "$(get_store_path "font-dejavu")"
|
|
|
|
rm -rf "$(get_store_path "util-linux")"
|
2023-06-29 16:53:05 +00:00
|
|
|
rm -rf "$(get_store_path "emacs-subdirs")"
|
|
|
|
rm -rf "$(get_store_path "info-dir")"
|
|
|
|
|
|
|
|
rm -rf "${GUIX_GLIBC:?}/share/i18n/locales"
|
|
|
|
rm -rf "${GUIX_GLIBC:?}/share/i18n/charmaps"
|
|
|
|
rm -rf "${GUIX_GLIBC:?}/share/locale"
|
|
|
|
rm -rf "${GUIX_GLIBC:?}/share/info"
|
|
|
|
rm -rf "${GUIX_GLIBC:?}/lib/gconv"
|
|
|
|
rm -rf "${GUIX_GLIBC:?}/include"
|
|
|
|
rm -rf "${GUIX_GLIBC:?}/sbin"
|
|
|
|
rm -rf "${GUIX_GLIBC:?}/bin"
|
2023-05-06 11:48:11 +00:00
|
|
|
|
|
|
|
# Fonts
|
|
|
|
# fontconfig looks in /app/share/fonts
|
2023-06-28 15:30:29 +00:00
|
|
|
ln -s "/run/host/fonts" share/fonts
|
|
|
|
ln -s "/run/host/fonts-cache" share/fonts-cache
|
2023-05-06 11:48:11 +00:00
|
|
|
ln -s "/${GUIX_PROFILE}/share/locale" share/locale
|
|
|
|
ln -s "/${GUIX_PROFILE}/share/xml" share/xml
|
|
|
|
|
2023-06-28 15:30:29 +00:00
|
|
|
# Setup profile symlink
|
|
|
|
ln -s "/${GUIX_PROFILE}" profile
|
2023-05-06 11:48:11 +00:00
|
|
|
|
2023-10-06 13:38:54 +00:00
|
|
|
chmod -R 555 .
|
|
|
|
|
|
|
|
cd /tmp-output
|
|
|
|
|
|
|
|
find . -print0 \
|
|
|
|
| xargs -0r touch --no-dereference --date="@${SOURCE_DATE_EPOCH}"
|
|
|
|
find . \
|
|
|
|
| sort \
|
2023-10-10 14:09:15 +00:00
|
|
|
| zip -y -X@ "${DISTNAME}-flatpak.zip" \
|
2023-10-06 13:38:54 +00:00
|
|
|
|| ( rm -f "${DISTNAME}-flatpak.zip" && exit 1 )
|
|
|
|
|
|
|
|
mv "${DISTNAME}-flatpak.zip" /output
|
|
|
|
|
|
|
|
cd /output
|
|
|
|
rm feather
|
|
|
|
|
|
|
|
sha256sum "${DISTNAME}-flatpak.zip" > SHA256SUMS.part
|