Skip to content

Commit 26d4824

Browse files
committed
Fix rpm arm
1 parent 6a4eb1f commit 26d4824

File tree

3 files changed

+53
-11
lines changed

3 files changed

+53
-11
lines changed

.github/workflows/build.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ jobs:
103103
- name: ⬆️ Checkout
104104
uses: actions/checkout@v4
105105
- name: Make yq tool available on Windows runners
106-
run: choco install yq
106+
run: |
107+
choco install yq
108+
choco install innosetup
107109
- uses: subosito/[email protected]
108110
with:
109111
flutter-version-file: app/pubspec.yaml

app/linux/rpm/linwood-setonix.spec

+10-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Name: linwood-setonix
22
Version: 1.0.0
33
Release: 1%{?dist}
44
Summary: Play games everywhere you like
5-
BuildArch: x86_64
5+
BuildArch: %{_target_cpu}
66
URL: https://github.com/LinwoodDev/Setonix
77
License: AGPLv3
88
Source0: %{name}-%{version}.tar.gz
@@ -20,11 +20,17 @@ rm -rf $RPM_BUILD_ROOT
2020
mkdir -p $RPM_BUILD_ROOT/%{_bindir}
2121
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/%{name}
2222
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/pixmaps
23+
24+
# Copy binaries and architecture-specific files
2325
cp %{name} $RPM_BUILD_ROOT/%{_datadir}/%{name}
2426
cp -R lib $RPM_BUILD_ROOT/%{_datadir}/%{name}
2527
cp -R data $RPM_BUILD_ROOT/%{_datadir}/%{name}
28+
29+
# Create symlink for the binary
2630
ln -s %{_datadir}/%{name}/%{name} $RPM_BUILD_ROOT/%{_bindir}/%{name}
27-
desktop-file-install %{name}.desktop
31+
32+
# Install the desktop file
33+
desktop-file-install --dir=$RPM_BUILD_ROOT/usr/share/applications %{name}.desktop
2834

2935
%clean
3036
rm -rf $RPM_BUILD_ROOT
@@ -33,3 +39,5 @@ rm -rf $RPM_BUILD_ROOT
3339
%{_bindir}/%{name}
3440
%{_datadir}/%{name}
3541
/usr/share/applications/
42+
43+
%changelog

app/scripts/build-rpm.sh

+40-8
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,72 @@
1+
#!/bin/bash
2+
3+
# Default values for architecture
4+
DIRECTORY_ARCH="x64" # Default directory name
5+
BINARY_ARCH="x86_64" # Default binary name
6+
RPM_ARCH="x86_64" # Default RPM architecture
7+
8+
# Parse command-line arguments
9+
while getopts "d:b:" opt; do
10+
case $opt in
11+
d) DIRECTORY_ARCH="$OPTARG" ;; # Set the directory architecture
12+
b) BINARY_ARCH="$OPTARG" ;; # Set the binary architecture
13+
*)
14+
echo "Usage: $0 [-d directory_arch] [-b binary_arch]"
15+
exit 1
16+
;;
17+
esac
18+
done
19+
RPM_ARCH=$BINARY_ARCH
20+
21+
# Normalize architecture names for RPM
22+
if [ "$RPM_ARCH" == "arm64" ]; then
23+
RPM_ARCH="aarch64"
24+
fi
125
# Read version from pubspec
226
SETONIX_VERSION_REGEX="version:\s(.+)\+(.+)"
327
[[ $(grep -E "${SETONIX_VERSION_REGEX}" pubspec.yaml) =~ ${SETONIX_VERSION_REGEX} ]]
428
SETONIX_VERSION="${BASH_REMATCH[1]}"
29+
530
# Replace - with ~ to match RPM versioning
631
RPM_VERSION=$(echo $SETONIX_VERSION | sed 's/-/~/g')
732
CURRENT_DIR=$(pwd)
8-
echo "Building Setonix $RPM_VERSION"
33+
echo "Building Setonix $RPM_VERSION for $DIRECTORY_ARCH/$BINARY_ARCH ($RPM_ARCH)"
34+
35+
# Clean and set up build directories
936
rm -rf build/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
1037
mkdir -p build/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
38+
1139
# Copy files
1240
cp linux/rpm/linwood-setonix.spec build/SPECS/linwood-setonix.spec
13-
cp -r build/linux/x64/release/bundle build/SOURCES/linwood-setonix-$RPM_VERSION
41+
cp -r build/linux/${DIRECTORY_ARCH}/release/bundle build/SOURCES/linwood-setonix-$RPM_VERSION
1442
chmod 755 build/SOURCES/linwood-setonix-$RPM_VERSION/setonix
1543
mv build/SOURCES/linwood-setonix-$RPM_VERSION/setonix build/SOURCES/linwood-setonix-$RPM_VERSION/linwood-setonix
1644
cp linux/rpm/linwood-setonix.desktop build/SOURCES/linwood-setonix-$RPM_VERSION/linwood-setonix.desktop
17-
# Change second line of spec file Version: to match version
45+
46+
# Update .spec file with the correct version
1847
sed -i "2s/.*/Version: $RPM_VERSION/" build/SPECS/linwood-setonix.spec
19-
# Create tar
48+
49+
# Create tarball
2050
cd build/SOURCES/
2151
# Fix .so files using patchelf
2252
cd linwood-setonix-$RPM_VERSION/lib
2353
for file in *.so; do
24-
PATCHELF_OUTPUT=$(patchelf --print-rpath $file)
54+
PATCHELF_OUTPUT=$(patchelf --print-rpath "$file")
2555
echo "Checking $file: $PATCHELF_OUTPUT"
2656
# Skip file if PATCHELF_OUTPUT does not contain CURRENT_DIR
2757
if [[ ! $PATCHELF_OUTPUT =~ $CURRENT_DIR ]]; then
2858
echo "Skipping $file"
2959
continue
3060
fi
3161
echo "Fixing $file"
32-
patchelf --set-rpath '$ORIGIN' $file
62+
patchelf --set-rpath '$ORIGIN' "$file"
3363
done
3464
cd ../../
3565
tar --create --file linwood-setonix-$RPM_VERSION.tar.gz linwood-setonix-$RPM_VERSION
3666
cd ../../
67+
3768
# Build RPM
3869
QA_RPATHS=$[ 0x0001|0x0010 ] rpmbuild -bb build/SPECS/linwood-setonix.spec --define "_topdir $(pwd)/build"
39-
# Copy RPM to build folder
40-
cp build/RPMS/x86_64/linwood-setonix-*.rpm build/linwood-setonix-linux-x86_64.rpm
70+
71+
# Copy the RPM to the build folder
72+
cp build/RPMS/${RPM_ARCH}/linwood-setonix-*.rpm build/linwood-setonix-linux-${BINARY_ARCH}.rpm

0 commit comments

Comments
 (0)