[ci] Make it POSIX-compliant
* tested on Ubuntu 25.04 Signed-off-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
This commit is contained in:
parent
b5f0711c6c
commit
6cbc989517
4 changed files with 73 additions and 28 deletions
|
@ -58,7 +58,7 @@ check_cmake_header() {
|
||||||
for file in $FILES; do
|
for file in $FILES; do
|
||||||
[ -f "$file" ] || continue
|
[ -f "$file" ] || continue
|
||||||
|
|
||||||
if [ "$(basename -- "$file")" = "CMakeLists.txt" ]; then
|
if [ "$(basename "$file")" = "CMakeLists.txt" ]; then
|
||||||
check_cmake_header "$file"
|
check_cmake_header "$file"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
@ -133,24 +133,24 @@ if [ "$FIX" = "true" ]; then
|
||||||
echo "license-header.sh: FIX set to true, fixing headers..."
|
echo "license-header.sh: FIX set to true, fixing headers..."
|
||||||
|
|
||||||
for file in $BAD_FILES; do
|
for file in $BAD_FILES; do
|
||||||
cp -- "$file" "$file.bak"
|
cp "$file" "$file.bak"
|
||||||
|
|
||||||
cat .ci/license/header.txt > "$file"
|
cat .ci/license/header.txt > "$file"
|
||||||
echo >> "$file"
|
echo >> "$file"
|
||||||
cat "$file.bak" >> "$file"
|
cat "$file.bak" >> "$file"
|
||||||
|
|
||||||
rm -- "$file.bak"
|
rm "$file.bak"
|
||||||
git add "$file"
|
git add "$file"
|
||||||
done
|
done
|
||||||
|
|
||||||
for file in $BAD_CMAKE; do
|
for file in $BAD_CMAKE; do
|
||||||
cp -- "$file" "$file.bak"
|
cp "$file" "$file.bak"
|
||||||
|
|
||||||
cat .ci/license/header-hash.txt > "$file"
|
cat .ci/license/header-hash.txt > "$file"
|
||||||
echo >> "$file"
|
echo >> "$file"
|
||||||
cat "$file.bak" >> "$file"
|
cat "$file.bak" >> "$file"
|
||||||
|
|
||||||
rm -- "$file.bak"
|
rm "$file.bak"
|
||||||
git add "$file"
|
git add "$file"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -164,8 +164,9 @@ if [ "$FIX" = "true" ]; then
|
||||||
git commit -m "[license] Fix license headers"
|
git commit -m "[license] Fix license headers"
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "license-header.sh: Changes committed. You may now push."
|
echo "license-header.sh: Changes committed. You may now push."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,59 @@
|
||||||
#!/bin/bash -ex
|
#!/bin/sh -e
|
||||||
|
|
||||||
# SPDX-FileCopyrightText: 2025 Eden Emulator Project
|
# SPDX-FileCopyrightText: 2025 Eden Emulator Project
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
# git-archive-all
|
GITDATE=$(git show -s --date=short --format='%ad' | sed 's/-//g')
|
||||||
export PATH="$PATH:/home/$USER/.local/bin"
|
GITREV=$(git show -s --format='%h')
|
||||||
|
|
||||||
GITDATE="$(git show -s --date=short --format='%ad' | sed 's/-//g')"
|
|
||||||
GITREV="$(git show -s --format='%h')"
|
|
||||||
REV_NAME="eden-unified-source-${GITDATE}-${GITREV}"
|
REV_NAME="eden-unified-source-${GITDATE}-${GITREV}"
|
||||||
|
|
||||||
COMPAT_LIST='dist/compatibility_list/compatibility_list.json'
|
COMPAT_LIST="dist/compatibility_list/compatibility_list.json"
|
||||||
|
ARTIFACT_DIR="artifacts"
|
||||||
|
ARCHIVE_PATH="${ARTIFACT_DIR}/${REV_NAME}.tar"
|
||||||
|
XZ_PATH="${ARCHIVE_PATH}.xz"
|
||||||
|
SHA_PATH="${XZ_PATH}.sha256sum"
|
||||||
|
|
||||||
mkdir artifacts
|
# Abort if archive already exists
|
||||||
|
if [ -e "$XZ_PATH" ]; then
|
||||||
|
echo "Error: Archive '$XZ_PATH' already exists. Aborting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
touch "${COMPAT_LIST}"
|
# Create output directory
|
||||||
git describe --abbrev=0 --always HEAD > GIT-COMMIT
|
mkdir -p "$ARTIFACT_DIR"
|
||||||
git describe --tags HEAD > GIT-TAG || echo 'unknown' > GIT-TAG
|
|
||||||
git-archive-all --include "${COMPAT_LIST}" --include GIT-COMMIT --include GIT-TAG --force-submodules artifacts/"${REV_NAME}.tar"
|
# Create temporary directory
|
||||||
|
TMPDIR=$(mktemp -d)
|
||||||
|
|
||||||
|
# Ensure compatibility list file exists
|
||||||
|
touch "$COMPAT_LIST"
|
||||||
|
cp "$COMPAT_LIST" "$TMPDIR/"
|
||||||
|
|
||||||
|
# Create base archive from git
|
||||||
|
git archive --format=tar --prefix="${REV_NAME}/" HEAD > "$ARCHIVE_PATH"
|
||||||
|
|
||||||
|
# Create commit and tag files with correct names
|
||||||
|
git describe --abbrev=0 --always HEAD > "$TMPDIR/GIT-COMMIT"
|
||||||
|
if ! git describe --tags HEAD > "$TMPDIR/GIT-TAG" 2>/dev/null; then
|
||||||
|
echo "unknown" > "$TMPDIR/GIT-TAG"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Append extra files to archive
|
||||||
|
tar --append --file="$ARCHIVE_PATH" -C "$TMPDIR" "$(basename "$COMPAT_LIST")" GIT-COMMIT GIT-TAG
|
||||||
|
|
||||||
|
# Remove temporary directory
|
||||||
|
rm -rf "$TMPDIR"
|
||||||
|
|
||||||
|
# Compress using xz
|
||||||
|
xz -9 "$ARCHIVE_PATH"
|
||||||
|
|
||||||
|
# Generate SHA-256 checksum (GNU vs BSD/macOS)
|
||||||
|
if command -v sha256sum >/dev/null 2>&1; then
|
||||||
|
sha256sum "$XZ_PATH" > "$SHA_PATH"
|
||||||
|
elif command -v shasum >/dev/null 2>&1; then
|
||||||
|
shasum -a 256 "$XZ_PATH" > "$SHA_PATH"
|
||||||
|
else
|
||||||
|
echo "No SHA-256 tool found (sha256sum or shasum required)" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
cd artifacts/
|
|
||||||
xz -T0 -9 "${REV_NAME}.tar"
|
|
||||||
sha256sum "${REV_NAME}.tar.xz" > "${REV_NAME}.tar.xz.sha256sum"
|
|
||||||
cd ..
|
|
||||||
|
|
|
@ -6,9 +6,7 @@
|
||||||
for i in dist/languages/*.ts; do
|
for i in dist/languages/*.ts; do
|
||||||
SRC=en_US
|
SRC=en_US
|
||||||
TARGET=$(head -n1 "$i" | awk -F 'language="' '{split($2, a, "\""); print a[1]}')
|
TARGET=$(head -n1 "$i" | awk -F 'language="' '{split($2, a, "\""); print a[1]}')
|
||||||
|
SOURCES=$(find src/yuzu -type f \( -name '*.ui' -o -name '*.cpp' -o -name '*.h' -o -name '*.plist' \))
|
||||||
# requires fd
|
|
||||||
SOURCES=$(fd . src/yuzu -tf -e ui -e cpp -e h -e plist)
|
|
||||||
|
|
||||||
lupdate -source-language $SRC -target-language "$TARGET" "$SOURCES" -ts /data/code/eden/"$i"
|
lupdate -source-language $SRC -target-language "$TARGET" "$SOURCES" -ts /data/code/eden/"$i"
|
||||||
done
|
done
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
# Check dependencies
|
# Check dependencies
|
||||||
for cmd in png2icns magick svgo; do
|
for cmd in png2icns magick svgo; do
|
||||||
if ! which "$cmd" >/dev/null 2>&1; then
|
if ! command -v "$cmd" >/dev/null 2>&1; then
|
||||||
pkg="$cmd"
|
pkg="$cmd"
|
||||||
case "$cmd" in
|
case "$cmd" in
|
||||||
png2icns) pkg="icnsutils" ;;
|
png2icns) pkg="icnsutils" ;;
|
||||||
|
@ -16,20 +16,32 @@ for cmd in png2icns magick svgo; do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
export EDEN_SVG_ICO="dist/dev.eden_emu.eden.svg"
|
EDEN_SVG_ICO="dist/dev.eden_emu.eden.svg"
|
||||||
TMP_PNG="$(mktemp /tmp/eden-tmp-XXXXXX.png)"
|
|
||||||
|
|
||||||
|
# Create temporary PNG file safely (and POSIX-compliant)
|
||||||
|
TMP_PNG=$(mktemp /tmp/eden-tmp-XXXXXX)
|
||||||
|
TMP_PNG="${TMP_PNG}.png"
|
||||||
|
|
||||||
|
# Optimize SVG
|
||||||
svgo --multipass "$EDEN_SVG_ICO"
|
svgo --multipass "$EDEN_SVG_ICO"
|
||||||
|
|
||||||
|
# Generate ICO
|
||||||
magick \
|
magick \
|
||||||
-density 256x256 -background transparent "$EDEN_SVG_ICO" \
|
-density 256x256 -background transparent "$EDEN_SVG_ICO" \
|
||||||
-define icon:auto-resize -colors 256 "dist/eden.ico"
|
-define icon:auto-resize -colors 256 "dist/eden.ico"
|
||||||
|
|
||||||
|
# Generate BMP
|
||||||
magick "$EDEN_SVG_ICO" -resize 256x256 -background transparent "dist/yuzu.bmp"
|
magick "$EDEN_SVG_ICO" -resize 256x256 -background transparent "dist/yuzu.bmp"
|
||||||
|
|
||||||
|
# Generate PNG for ICNS
|
||||||
magick -size 1024x1024 -background transparent "$EDEN_SVG_ICO" "$TMP_PNG"
|
magick -size 1024x1024 -background transparent "$EDEN_SVG_ICO" "$TMP_PNG"
|
||||||
|
|
||||||
|
# Generate ICNS
|
||||||
png2icns "dist/eden.icns" "$TMP_PNG"
|
png2icns "dist/eden.icns" "$TMP_PNG"
|
||||||
|
|
||||||
|
# Copy ICNS to Yuzu file
|
||||||
cp "dist/eden.icns" "dist/yuzu.icns"
|
cp "dist/eden.icns" "dist/yuzu.icns"
|
||||||
|
|
||||||
|
# Remove temporary PNG
|
||||||
rm -f "$TMP_PNG"
|
rm -f "$TMP_PNG"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue