Skip to content

Commit 62c44cc

Browse files
authored
Clang build (#1)
* clang PKGBUILDs * patches for pcaudiolib and espeak-ng * Clang installer, SDL patch * Add missing patch dependency
1 parent f3fcd1d commit 62c44cc

18 files changed

Lines changed: 13349 additions & 59 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ packages/
44
oolite/
55

66
# But keep these
7-
!mingw-w64-*/PKGBUILD
7+
!mingw-w64-*/PKGBUILD*
88
!mingw-w64-*/*.patch
99
!mingw-w64-*/*.txt

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Oolite MSYS2 MinGW64 Environment
22

3-
Double click Run Me. You will be prompted for an install location. If you type c:, MSYS2 will be installed in c:\msys64. Then Oolite's dependencies will be installed followed by Oolite itself.
3+
Double click Run Me. You will be prompted for an install location. If you type c:, MSYS2 will be installed in c:\msys64. Then Oolite's dependencies will be installed followed by Oolite itself. A gcc build is created by default.
44

55
Once completed, you can type the following in the shell:
66

77
cd oolite/oolite.app
8-
./oolite.exe
8+
./oolite.exe
9+
10+
By default, install.sh is run with parameter gcc by setup.cmd (which is started by Run Me). install.sh can be run with parameter clang for a clang build. The GitHub Action passes no parameters which creates a clang build followed by a gcc build.

install.sh

Lines changed: 85 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,116 @@
1+
# No parameters: build both clang and gcc in that order (end setup will be for gcc)
2+
# One parameter gcc = build gcc only (end setup will be for gcc)
3+
# One parameter clang = build clang only (end setup will be for clang)
4+
15
pacman -S dos2unix --noconfirm
26
pacman -S pactoys --noconfirm
37
pacboy -S binutils --noconfirm
48

59
rm -rf packages
610
mkdir packages
711

8-
package_names=(gnustep-make gnustep-base spidermonkey pcaudiolib espeak-ng SDL)
12+
build_install() {
13+
# First parameter is package name
14+
# Second optional parameter is gcc or clang
15+
echo "Building and installing $1 package"
16+
cd mingw-w64-$1
17+
# Deletes everything except PKGBUILD* and *.patch
18+
find . -mindepth 1 ! -name 'PKGBUILD*' ! -name '*.patch' -exec rm -rf {} +
919

10-
for packagename in "${package_names[@]}"; do
11-
echo "Building and installing $packagename package"
12-
cd mingw-w64-$packagename
13-
# Deletes everything except PKGBUILD and *.patch
14-
find . -mindepth 1 ! -name PKGBUILD ! -name '*.patch' -exec rm -rf {} +
20+
if [ -z "$2" ]; then
21+
fullname=$1
22+
else
23+
# copy PKGBUILD_gcc or PKGBUILD_clang to PKGBUILD
24+
fullname="${1}_${2}"
25+
cp "PKGBUILD_${2}" PKGBUILD
26+
fi
1527
dos2unix PKGBUILD *.patch
1628
if ! makepkg -s -f --noconfirm ; then
17-
echo "$packagename build failed!"
29+
echo "$1 build failed!"
1830
exit 1
1931
fi
20-
if ! pacman -U *$packagename*any.pkg.tar.zst --noconfirm ; then
21-
echo "$packagename install failed!"
32+
33+
pattern="*$1*any.pkg.tar.zst"
34+
# package file eg. mingw-w64-x86_64-libobjc2-2.3-3-any.pkg.tar.zst
35+
filename=$(ls $pattern 2>/dev/null)
36+
if [ -z "$filename" ]; then
37+
echo "❌ No file matching $pattern found."
38+
exit 1
39+
fi
40+
if [ "$2" ]; then
41+
# add gcc or clang to filename
42+
newname="${filename/$1/$fullname}"
43+
mv $filename $newname
44+
filename=$newname
45+
fi
46+
if ! pacman -U $filename --noconfirm ; then
47+
echo "$filename install failed!"
2248
exit 1
2349
fi
24-
rm -f ../packages/*$packagename*any.pkg.tar.zst
25-
mv *$packagename*any.pkg.tar.zst ../packages
50+
rm -f ../packages/*$fullname*any.pkg.tar.zst
51+
mv $filename ../packages
2652
cd ..
53+
}
54+
55+
echo "Building common libraries"
56+
package_names=(spidermonkey pcaudiolib espeak-ng SDL)
57+
for packagename in "${package_names[@]}"; do
58+
build_install $packagename
2759
done
2860

2961
pacman -S git --noconfirm
3062
pacboy -S libpng --noconfirm
3163
pacboy -S openal --noconfirm
3264
pacboy -S libvorbis --noconfirm
3365

34-
pacman -Q > packages/installed-packages.txt
35-
3666
rm -rf oolite
37-
git clone -b modern_build https://github.com/mcarans/oolite.git
67+
git clone -b modern_build --filter=blob:none https://github.com/mcarans/oolite.git
3868
cd oolite
39-
4069
cp .absolute_gitmodules .gitmodules
4170
git submodule update --init
4271
git checkout -- .gitmodules
72+
cd ..
73+
74+
if [[ -z "$1" || "$1" == "clang" ]]; then
75+
echo "Building GNUStep libraries with clang"
76+
export cc=/mingw64/bin/clang
77+
export cpp=/mingw64/bin/clang++
78+
clang_package_names=(libobjc2 gnustep-make gnustep-base)
79+
for packagename in "${clang_package_names[@]}"; do
80+
build_install $packagename clang
81+
done
82+
pacman -Q > packages/installed-packages-clang.txt
83+
source /mingw64/share/GNUstep/Makefiles/GNUstep.sh
4384

44-
source /mingw64/share/GNUstep/Makefiles/GNUstep.sh
45-
make -f Makefile clean
46-
make -f Makefile release -j16
85+
cd oolite
86+
make -f Makefile clean
87+
make -f Makefile release -j16
88+
cd ..
89+
fi
90+
91+
if [[ -z "$1" ]]; then
92+
echo "Uninstalling clang GNUStep libraries"
93+
pacboy -R gnustep-base
94+
pacboy -R gnustep-make
95+
pacboy -R libobjc2
96+
fi
97+
98+
if [[ -z "$1" || "$1" == "gcc" ]]; then
99+
echo "Building GNUStep libraries with gcc"
100+
export cc=/mingw64/bin/gcc
101+
export cpp=/mingw64/bin/g++
102+
gcc_package_names=(gnustep-make gnustep-base)
103+
for packagename in "${gcc_package_names[@]}"; do
104+
build_install $packagename gcc
105+
done
106+
pacman -Q > packages/installed-packages-gcc.txt
107+
source /mingw64/share/GNUstep/Makefiles/GNUstep.sh
108+
109+
cd oolite
110+
make -f Makefile clean
111+
make -f Makefile release -j16
112+
cd ..
113+
fi
47114

48115
cp /mingw64/share/GNUstep/Makefiles/GNUstep.sh /etc/profile.d/
49116

0 commit comments

Comments
 (0)