Skip to content

Commit

Permalink
streamlined
Browse files Browse the repository at this point in the history
  • Loading branch information
Azathothas committed Sep 25, 2024
1 parent b1af9fe commit 009caf6
Show file tree
Hide file tree
Showing 8 changed files with 315 additions and 27 deletions.
129 changes: 129 additions & 0 deletions .github/scripts/aarch64-Linux/pkgs/librewolf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
#!/usr/bin/env bash
set -x
#-------------------------------------------------------#
#Sanity Checks
if [ "${BUILD}" != "YES" ] || \
[ -z "${BINDIR}" ] || \
[ -z "${GIT_TERMINAL_PROMPT}" ] || \
[ -z "${GIT_ASKPASS}" ] || \
[ -z "${GITHUB_TOKEN}" ] || \
[ -z "${SYSTMP}" ] || \
[ -z "${TMPDIRS}" ]; then
#exit
echo -e "\n[+]Skipping Builds...\n"
exit 1
fi
#-------------------------------------------------------#

#-------------------------------------------------------#
##Main
export SKIP_BUILD="NO"
if [ "$SKIP_BUILD" == "NO" ]; then
#librewolf : LibreWolf Web Browser is a fork of Firefox, focused on privacy, security and freedom
export BIN="librewolf"
export SOURCE_URL="https://codeberg.org/librewolf"
echo -e "\n\n [+] (Building | Fetching) $BIN :: $SOURCE_URL\n"
#-------------------------------------------------------#
##Fetch :https://github.com/ivan-hc/AM/blob/main/programs/x86_64/librewolf
pushd "$($TMPDIRS)" >/dev/null 2>&1
RELEASE_TAG="$( curl -qfsSL "https://gitlab.com/api/v4/projects/24386000/releases/" | jq -r '.[0].tag_name' | tr -d '[:space:]')" && export RELEASE_TAG="${RELEASE_TAG}"
curl -qfsSL "https://gitlab.com/api/v4/projects/24386000/releases/${RELEASE_TAG}" | jq --arg ARCH "$(uname -m)" \
-r '.assets | (.sources[]?.url, .links[]?.url) | select(. | contains($ARCH) and endswith(".AppImage"))' | tr -d '[:space:]'|\
xargs -I "{}" curl -qfsSL "{}" -o "${BINDIR}/librewolf.AppImage"
popd >/dev/null 2>&1
#Meta
if [[ -f "${BINDIR}/librewolf.AppImage" ]] && [[ $(stat -c%s "${BINDIR}/librewolf.AppImage") -gt 1024 ]]; then
PKG_VERSION="$(echo ${RELEASE_TAG})" && export PKG_VERSION="${PKG_VERSION}"
echo "${PKG_VERSION}" > "${BINDIR}/librewolf.AppImage.version"
realpath "${BINDIR}/librewolf.AppImage" | xargs -I {} sh -c 'file {}; b3sum {}; sha256sum {}; du -sh {}'
fi
#-------------------------------------------------------#
##Create NixAppImage
pushd "$($TMPDIRS)" >/dev/null 2>&1
nix bundle --bundler "github:ralismark/nix-appimage" "nixpkgs#librewolf" --log-format bar-with-logs
#Copy
sudo rsync -av --copy-links "./librewolf.AppImage" "./librewolf.NixAppImage.tmp"
sudo chown -R "$(whoami):$(whoami)" "./librewolf.NixAppImage.tmp" && chmod -R 755 "./librewolf.NixAppImage.tmp"
du -sh "./librewolf.NixAppImage.tmp" && file "./librewolf.NixAppImage.tmp"
##Extract
APPIMAGE="$(realpath .)/librewolf.NixAppImage.tmp" && export APPIMAGE="${APPIMAGE}"
"${APPIMAGE}" --appimage-extract >/dev/null && rm -f "${APPIMAGE}"
OWD="$(realpath .)" && export OWD="${OWD}"
APPIMAGE_EXTRACT="$(realpath "./squashfs-root")" && export APPIMAGE_EXTRACT="${APPIMAGE_EXTRACT}"
##Patch
if [ -d "${APPIMAGE_EXTRACT}" ] && [ "$(find "${APPIMAGE_EXTRACT}" -mindepth 1 -print -quit 2>/dev/null)" ]; then
#Media
cd "${APPIMAGE_EXTRACT}"
mkdir -p "./usr/share/applications" && mkdir -p "./usr/share/metainfo"
SHARE_DIR="$(find "${APPIMAGE_EXTRACT}" -path '*share/*librewolf*' | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | awk -F'/share/' '{print $1}')/share" && export SHARE_DIR="${SHARE_DIR}"
#usr/{applications,bash-completion,icons,metainfo,librewolf,zsh}
rsync -av --copy-links \
--include="*/" \
--include="*.desktop" \
--include="*.png" \
--include="*.svg" \
--include="*.xml" \
--exclude="*" \
"${SHARE_DIR}/" "./usr/share/" && ls "./usr/share/"
#Icon
find "${APPIMAGE_EXTRACT}" \( -path '*128x128/apps/*.png' -o -path '*256x256/apps/*.png' \) | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | xargs -I {} convert {} -resize "128x128" "./librewolf.png"
find "${APPIMAGE_EXTRACT}" -maxdepth 1 -type f -name '*.png' -exec sh -c 'convert "$0" -resize "128x128" "${0%.svg}.png"' {} \; 2>/dev/null
cp "./librewolf.png" "./.DirIcon"
##Desktop
find "${APPIMAGE_EXTRACT}" -path '*librewolf*.desktop' | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | xargs -I {} sh -c 'cp {} "./librewolf.desktop"'
sed 's/Icon=[^ ]*/Icon=librewolf/' -i "./librewolf.desktop" 2>/dev/null
##Perms
find "${APPIMAGE_EXTRACT}" -maxdepth 1 -type f -exec chmod "u=rx,go=rx" {} +
##Purge Bloatware
echo -e "\n[+] Purging Bloatware...\n"
O_SIZE="$(du -sh "${APPIMAGE_EXTRACT}" 2>/dev/null | awk '{print $1}' 2>/dev/null)" && export "O_SIZE=${O_SIZE}"
#Headers
find "${APPIMAGE_EXTRACT}" -type d -path "*/include*" -print -exec rm -rf {} 2>/dev/null \; 2>/dev/null
#docs & manpages
find "${APPIMAGE_EXTRACT}" -type d -path "*doc/share*" ! -name "*librewolf*" -print -exec rm -rf {} 2>/dev/null \; 2>/dev/null
find "${APPIMAGE_EXTRACT}" -type d -path "*/share/docs*" ! -name "*librewolf*" -print -exec rm -rf {} 2>/dev/null \; 2>/dev/null
find "${APPIMAGE_EXTRACT}" -type d -path "*/share/man*" ! -name "*librewolf*" -print -exec rm -rf {} 2>/dev/null \; 2>/dev/null
#static libs
find "${APPIMAGE_EXTRACT}" -type f -name "*.a" -print -exec rm -f {} 2>/dev/null \; 2>/dev/null
#systemd (need .so)
find "${APPIMAGE_EXTRACT}" -type d -name "*systemd*" -exec find {} -type f ! -name "*.so*" -delete \;
P_SIZE="$(du -sh "${APPIMAGE_EXTRACT}" 2>/dev/null | awk '{print $1}' 2>/dev/null)" && export "P_SIZE=${P_SIZE}"
echo -e "\n[+] Shaved off ${O_SIZE} --> ${P_SIZE}\n"
#(Re)Pack
cd "${OWD}"
curl -qfsSL "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$(uname -m).AppImage" -o "./appimagetool" && chmod +x "./appimagetool"
ARCH="$(uname -m)" "./appimagetool" --comp "zstd" \
--mksquashfs-opt -root-owned \
--mksquashfs-opt -no-xattrs \
--mksquashfs-opt -noappend \
--mksquashfs-opt -b --mksquashfs-opt "1M" \
--mksquashfs-opt -mkfs-time --mksquashfs-opt "0" \
--mksquashfs-opt -Xcompression-level --mksquashfs-opt "22" \
"${APPIMAGE_EXTRACT}" "${BINDIR}/librewolf.NixAppImage"
#clean
unset APPIMAGE APPIMAGE_EXTRACT OFFSET OWD SHARE_DIR ; popd >/dev/null 2>&1
fi
#-------------------------------------------------------#
#Meta
if [[ -f "${BINDIR}/librewolf.NixAppImage" ]] && [[ $(stat -c%s "${BINDIR}/librewolf.NixAppImage") -gt 1024 ]]; then
PKG_VERSION="$(nix derivation show "nixpkgs#librewolf" 2>&1 | grep '"version"' | awk -F': ' '{print $2}' | tr -d '"')" && export PKG_VERSION="${PKG_VERSION}"
echo "${PKG_VERSION}" > "${BINDIR}/librewolf.NixAppImage.version"
realpath "${BINDIR}/librewolf.NixAppImage" | xargs -I {} sh -c 'file {}; b3sum {}; sha256sum {}; du -sh {}'
fi
#End
LOG_PATH="${BINDIR}/librewolf.log" && export LOG_PATH="${LOG_PATH}"
popd >/dev/null 2>&1
fi
#-------------------------------------------------------#

#-------------------------------------------------------#
##Cleanup
unset SKIP_BUILD ; export BUILT="YES"
#In case of zig polluted env
unset AR CC CFLAGS CXX CPPFLAGS CXXFLAGS DLLTOOL HOST_CC HOST_CXX LDFLAGS LIBS OBJCOPY RANLIB
#In case of go polluted env
unset GOARCH GOOS CGO_ENABLED CGO_CFLAGS
#PKG Config
unset PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_DIR PKG_CONFIG_SYSTEM_INCLUDE_PATH PKG_CONFIG_SYSTEM_LIBRARY_PATH
set +x
#-------------------------------------------------------#
14 changes: 14 additions & 0 deletions .github/scripts/aarch64-Linux/pkgs/librewolf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#https://github.com/ivan-hc/AM/blob/main/programs/x86_64/librewolf
name: "librewolf"
bin_name: "librewolf"
bins:
- "librewolf.AppImage"
- "librewolf.NixAppImage"
category:
- "browser"
- "privacy"
description: "LibreWolf Web Browser is a fork of Firefox, focused on privacy, security and freedom (AppImage|NixAppImage)"
note: "This PKG has Multiple Formats (CI_VERIFIED: https://gitlab.com/librewolf-community/browser/appimage/-/pipelines)"
web_url: "https://librewolf.net"
path: "/"
src_url: "https://gitlab.com/librewolf-community/browser"
24 changes: 12 additions & 12 deletions .github/scripts/aarch64-Linux/pkgs/mullvad-browser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ fi

#-------------------------------------------------------#
##Main
export SKIP_BUILD="NO"
export SKIP_BUILD="YES" #no aarch64 support yet
if [ "$SKIP_BUILD" == "NO" ]; then
#mullvad-browser : Unarchiver
#mullvad-browser : Privacy-focused browser for Linux, macOS and Windows
export BIN="mullvad-browser"
export SOURCE_URL="https://github.com/mullvad/mullvad-browser"
echo -e "\n\n [+] (Building | Fetching) $BIN :: $SOURCE_URL\n"
Expand All @@ -36,17 +36,18 @@ if [ "$SKIP_BUILD" == "NO" ]; then
# if [[ -f "${BINDIR}/mullvad-browser.tar.xz" ]] && [[ $(stat -c%s "${BINDIR}/mullvad-browser.tar.xz") -gt 1024 ]]; then
# PKG_VERSION="$(echo ${RELEASE_TAG})" && export PKG_VERSION="${PKG_VERSION}"
# echo "${PKG_VERSION}" > "${BINDIR}/mullvad-browser.tar.xz.version"
# realpath "${BINDIR}/mullvad-browser.tar.xz" | xargs -I {} sh -c 'file {}; b3sum {}; sha256sum {}; du -sh {}'
# fi
#-------------------------------------------------------#
##Create AppImage
##Create NixAppImage
pushd "$($TMPDIRS)" >/dev/null 2>&1
nix bundle --bundler "github:ralismark/nix-appimage" "nixpkgs#mullvad-browser" --log-format bar-with-logs
#Copy
sudo rsync -av --copy-links "./mullvad-browser.AppImage" "./mullvad-browser.AppImage.tmp"
sudo chown -R "$(whoami):$(whoami)" "./mullvad-browser.AppImage.tmp" && chmod -R 755 "./mullvad-browser.AppImage.tmp"
du -sh "./mullvad-browser.AppImage.tmp" && file "./mullvad-browser.AppImage.tmp"
sudo rsync -av --copy-links "./mullvad-browser.AppImage" "./mullvad-browser.NixAppImage.tmp"
sudo chown -R "$(whoami):$(whoami)" "./mullvad-browser.NixAppImage.tmp" && chmod -R 755 "./mullvad-browser.NixAppImage.tmp"
du -sh "./mullvad-browser.NixAppImage.tmp" && file "./mullvad-browser.NixAppImage.tmp"
##Extract
APPIMAGE="$(realpath .)/mullvad-browser.AppImage.tmp" && export APPIMAGE="${APPIMAGE}"
APPIMAGE="$(realpath .)/mullvad-browser.NixAppImage.tmp" && export APPIMAGE="${APPIMAGE}"
"${APPIMAGE}" --appimage-extract >/dev/null && rm -f "${APPIMAGE}"
OWD="$(realpath .)" && export OWD="${OWD}"
APPIMAGE_EXTRACT="$(realpath "./squashfs-root")" && export APPIMAGE_EXTRACT="${APPIMAGE_EXTRACT}"
Expand Down Expand Up @@ -99,19 +100,18 @@ if [ "$SKIP_BUILD" == "NO" ]; then
--mksquashfs-opt -b --mksquashfs-opt "1M" \
--mksquashfs-opt -mkfs-time --mksquashfs-opt "0" \
--mksquashfs-opt -Xcompression-level --mksquashfs-opt "22" \
"${APPIMAGE_EXTRACT}" "${BINDIR}/mullvad-browser.AppImage"
"${APPIMAGE_EXTRACT}" "${BINDIR}/mullvad-browser.NixAppImage"
#clean
unset APPIMAGE APPIMAGE_EXTRACT OFFSET OWD SHARE_DIR ; popd >/dev/null 2>&1
fi
#-------------------------------------------------------#
#Meta
if [[ -f "${BINDIR}/mullvad-browser.AppImage" ]] && [[ $(stat -c%s "${BINDIR}/mullvad-browser.AppImage") -gt 1024 ]]; then
if [[ -f "${BINDIR}/mullvad-browser.NixAppImage" ]] && [[ $(stat -c%s "${BINDIR}/mullvad-browser.NixAppImage") -gt 1024 ]]; then
PKG_VERSION="$(nix derivation show "nixpkgs#mullvad-browser" 2>&1 | grep '"version"' | awk -F': ' '{print $2}' | tr -d '"')" && export PKG_VERSION="${PKG_VERSION}"
echo "${PKG_VERSION}" > "${BINDIR}/mullvad-browser.AppImage.version"
echo "${PKG_VERSION}" > "${BINDIR}/mullvad-browser.NixAppImage.version"
realpath "${BINDIR}/mullvad-browser.NixAppImage" | xargs -I {} sh -c 'file {}; b3sum {}; sha256sum {}; du -sh {}'
fi
#End
#realpath "${BINDIR}/mullvad-browser.tar.xz" | xargs -I {} sh -c 'file {}; b3sum {}; sha256sum {}; du -sh {}'
realpath "${BINDIR}/mullvad-browser.AppImage" | xargs -I {} sh -c 'file {}; b3sum {}; sha256sum {}; du -sh {}'
LOG_PATH="${BINDIR}/mullvad-browser.log" && export LOG_PATH="${LOG_PATH}"
popd >/dev/null 2>&1
fi
Expand Down
6 changes: 4 additions & 2 deletions .github/scripts/aarch64-Linux/pkgs/mullvad-browser.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#https://github.com/ivan-hc/AM/blob/main/programs/x86_64/mullvad-browser
name: "mullvad-browser"
bin_name: "mullvad-browser"
bins:
- "mullvad-browser.AppImage"
- "mullvad-browser.NixAppImage"
- "mullvad-browser.tar.xz"
category:
- "anonymity"
- "browser"
- "privacy"
- "tor"
description: "Privacy-focused browser for Linux, macOS and Windows"
description: "Privacy-focused browser for Linux, macOS and Windows (Archive|AppImage|NixAppImage)"
note: "This PKG has Multiple Formats (CI_VERIFIED: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/pipelines)"
web_url: "https://mullvad.net/en/browser"
path: "/"
Expand Down
Loading

0 comments on commit 009caf6

Please sign in to comment.