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

trying to make comprehensive builder/boilerplate #2

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
47 changes: 47 additions & 0 deletions app.metainfo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id></id>
<metadata_license>CC0-1.0</metadata_license>
<!-- Also available FSFAP MIT 0BSD CC0-1.0 CC0-1.0 CC-BY-3.0 CC-BY-4.0 CC-BY-SA-3.0 CC-BY-SA-4.0 GFDL-1.1 GFDL-1.2 GFDL-1.3 BSL-1.0 FTL FSFUL -->
<name></name>
<summary></summary>
<summary xml:lang=""></summary>
<description>
<p>Steam is a software distribution service with an online store, automated installation, automatic updates, achievements, SteamCloud synchronized savegame and screenshot functionality, and many social features.</p>
</description>
<!-- Follow this guideline https://specifications.freedesktop.org/menu-spec/latest/category-registry.html-->
<categories>
<category></category>
<category></category>
</categories>
<url type="homepage"></url>
<url type="bugtracker"></url>
<url type="faq"></url>
<url type="help"></url>
<url type="donation"></url>
<url type="translate"></url>
<url type="contact"></url>
<url type="vcs-browser"></url>
<url type="contribute"></url>
<!-- Please follow SPDX License expressions https://spdx.org/specifications -->
<project_license>LicenseRef-proprietary=https://example.com/mylicense.html</project_license>
<developer></developer>
<screenshots>
<screenshot type="default">
<caption></caption>
<caption xml:lang=""></caption>
<image type="source" width="1200" height="1026"></image>
</screenshot>
</screenshots>
<launchable type="desktop-id"></launchable>
<releases>
<release version="1.0.0.82" date="2024-10-03">
<description></description>
</release>
</releases>
<bundle type="appimage">pkgname-pkgversion</bundle>
<content_rating type="oars-1.1">
<!-- Can be generated via https://hughsie.github.io/oars/generate.html -->
<content_attribute id="social-chat">intense</content_attribute>
</content_rating>
</component>
Drsheppard01 marked this conversation as resolved.
Show resolved Hide resolved
84 changes: 84 additions & 0 deletions template.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/bin/sh

## arguments for script and run

set -eu
export ARCH="$(uname -m)"
export APPIMAGE_EXTRACT_AND_RUN=1

## tools that will be used next
APPIMAGETOOL="https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$ARCH.AppImage"
LIB4BN="https://raw.githubusercontent.com/VHSgunzo/sharun/refs/heads/main/lib4bin"
URUNTIME="$(wget -q https://api.github.com/repos/VHSgunzo/uruntime/releases -O - \
| sed 's/[()",{} ]/\n/g' | grep -oi "https.*appimage.*dwarfs.*$ARCH$" | head -1)"


## useful meta for appimagetool
## APP_NAME=
## DESKTOP=
## ICON=
UPINFO="gh-releases-zsync|$(echo "$REPO" | tr '/' '|')|latest|*$ARCH.AppImage.zsync"


make_appdir() {
mkdir -p .AppDir
mkdir -p .AppDir/share/icon
mkdir -p .AppDir/share/metainfo
mkdir -p .AppDir/lib
mkdir -p .AppDir/bin
}

build() {
CURRENTDIR="$(readlink -f "$(dirname "$0")")"
git clone $REPO
}

bundle_libs() {
mv ./usr/bin ./
wget "$LIB4BN" -O ./lib4bin
chmod +x ./lib4bin
./lib4bin -p -v -r -s ./bin/*
rm -f ./lib4bin
}

add_sound_libs() {
cp -rv /usr/lib/alsa-lib ./usr/lib
cp -rv /usr/lib/pipewire-0.3 ./usr/lib
cp -rv /usr/lib/spa-0.2 ./usr/lib
}

add_graphics_libs() {
cp -vr /usr/lib/libGLX* ./shared/lib || true
cp -vr /usr/lib/libEGL* ./shared/lib || true
cp -vr /usr/lib/dri ./shared/lib
cp -vn /usr/lib/libvulkan* ./shared/lib
ldd ./shared/lib/dri/* \
./shared/lib/libvulkan* \
./shared/lib/libEGL* \
./shared/lib/libGLX* 2>/dev/null \
| awk -F"[> ]" '{print $4}' | xargs -I {} cp -nv {} ./shared/lib || true
mkdir -p ./share/vulkan
cp -vr /usr/share/glvnd ./share
cp -vr /usr/share/vulkan/icd.d ./share/vulkan
sed -i 's|/usr/lib||g;s|/.*-linux-gnu||g;s|"/|"|g' ./share/vulkan/icd.d/*
}
Drsheppard01 marked this conversation as resolved.
Show resolved Hide resolved

sharun() {
ln -s ./bin/obs ./AppRun
./sharun -g
}
Drsheppard01 marked this conversation as resolved.
Show resolved Hide resolved

generate_app() {
printf "$UPINFO" > data.upd_info
llvm-objcopy --update-section=.upd_info=data.upd_info \
--set-section-flags=.upd_info=noload,readonly ./uruntime
printf 'AI\x02' | dd of=./uruntime bs=1 count=3 seek=8 conv=notrunc
wget -q "$URUNTIME" -O ./uruntime
chmod +x ./uruntime
./uruntime --appimage-mkdwarfs -f \
--set-owner 0 --set-group 0 \
--no-history --no-create-timestamp \
--compression zstd:level=22 -S24 -B16 \
--header uruntime \
-i ./AppDir -o "$PACKAGE"-"$VERSION"-anylinux-"$ARCH".AppImage
}