[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
|
||||
[ -f "$file" ] || continue
|
||||
|
||||
if [ "$(basename -- "$file")" = "CMakeLists.txt" ]; then
|
||||
if [ "$(basename "$file")" = "CMakeLists.txt" ]; then
|
||||
check_cmake_header "$file"
|
||||
continue
|
||||
fi
|
||||
|
@ -133,24 +133,24 @@ if [ "$FIX" = "true" ]; then
|
|||
echo "license-header.sh: FIX set to true, fixing headers..."
|
||||
|
||||
for file in $BAD_FILES; do
|
||||
cp -- "$file" "$file.bak"
|
||||
cp "$file" "$file.bak"
|
||||
|
||||
cat .ci/license/header.txt > "$file"
|
||||
echo >> "$file"
|
||||
cat "$file.bak" >> "$file"
|
||||
|
||||
rm -- "$file.bak"
|
||||
rm "$file.bak"
|
||||
git add "$file"
|
||||
done
|
||||
|
||||
for file in $BAD_CMAKE; do
|
||||
cp -- "$file" "$file.bak"
|
||||
cp "$file" "$file.bak"
|
||||
|
||||
cat .ci/license/header-hash.txt > "$file"
|
||||
echo >> "$file"
|
||||
cat "$file.bak" >> "$file"
|
||||
|
||||
rm -- "$file.bak"
|
||||
rm "$file.bak"
|
||||
git add "$file"
|
||||
done
|
||||
|
||||
|
@ -164,8 +164,9 @@ if [ "$FIX" = "true" ]; then
|
|||
git commit -m "[license] Fix license headers"
|
||||
|
||||
echo
|
||||
echo "license-header.sh: Changes committed. You may now push."
|
||||
echo "license-header.sh: Changes committed. You may now push."
|
||||
fi
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,25 +1,59 @@
|
|||
#!/bin/bash -ex
|
||||
#!/bin/sh -e
|
||||
|
||||
# SPDX-FileCopyrightText: 2025 Eden Emulator Project
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# git-archive-all
|
||||
export PATH="$PATH:/home/$USER/.local/bin"
|
||||
|
||||
GITDATE="$(git show -s --date=short --format='%ad' | sed 's/-//g')"
|
||||
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}"
|
||||
|
||||
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}"
|
||||
git describe --abbrev=0 --always HEAD > GIT-COMMIT
|
||||
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 output directory
|
||||
mkdir -p "$ARTIFACT_DIR"
|
||||
|
||||
# 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
|
||||
SRC=en_US
|
||||
TARGET=$(head -n1 "$i" | awk -F 'language="' '{split($2, a, "\""); print a[1]}')
|
||||
|
||||
# requires fd
|
||||
SOURCES=$(fd . src/yuzu -tf -e ui -e cpp -e h -e plist)
|
||||
SOURCES=$(find src/yuzu -type f \( -name '*.ui' -o -name '*.cpp' -o -name '*.h' -o -name '*.plist' \))
|
||||
|
||||
lupdate -source-language $SRC -target-language "$TARGET" "$SOURCES" -ts /data/code/eden/"$i"
|
||||
done
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
# Check dependencies
|
||||
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"
|
||||
case "$cmd" in
|
||||
png2icns) pkg="icnsutils" ;;
|
||||
|
@ -16,20 +16,32 @@ for cmd in png2icns magick svgo; do
|
|||
fi
|
||||
done
|
||||
|
||||
export EDEN_SVG_ICO="dist/dev.eden_emu.eden.svg"
|
||||
TMP_PNG="$(mktemp /tmp/eden-tmp-XXXXXX.png)"
|
||||
EDEN_SVG_ICO="dist/dev.eden_emu.eden.svg"
|
||||
|
||||
# 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"
|
||||
|
||||
# Generate ICO
|
||||
magick \
|
||||
-density 256x256 -background transparent "$EDEN_SVG_ICO" \
|
||||
-define icon:auto-resize -colors 256 "dist/eden.ico"
|
||||
|
||||
# Generate 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"
|
||||
|
||||
# Generate ICNS
|
||||
png2icns "dist/eden.icns" "$TMP_PNG"
|
||||
|
||||
# Copy ICNS to Yuzu file
|
||||
cp "dist/eden.icns" "dist/yuzu.icns"
|
||||
|
||||
# Remove temporary PNG
|
||||
rm -f "$TMP_PNG"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue