|
| 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 | + |
1 | 5 | pacman -S dos2unix --noconfirm |
2 | 6 | pacman -S pactoys --noconfirm |
3 | 7 | pacboy -S binutils --noconfirm |
4 | 8 |
|
5 | 9 | rm -rf packages |
6 | 10 | mkdir packages |
7 | 11 |
|
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 {} + |
9 | 19 |
|
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 |
15 | 27 | dos2unix PKGBUILD *.patch |
16 | 28 | if ! makepkg -s -f --noconfirm ; then |
17 | | - echo "❌ $packagename build failed!" |
| 29 | + echo "❌ $1 build failed!" |
18 | 30 | exit 1 |
19 | 31 | 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!" |
22 | 48 | exit 1 |
23 | 49 | 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 |
26 | 52 | 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 |
27 | 59 | done |
28 | 60 |
|
29 | 61 | pacman -S git --noconfirm |
30 | 62 | pacboy -S libpng --noconfirm |
31 | 63 | pacboy -S openal --noconfirm |
32 | 64 | pacboy -S libvorbis --noconfirm |
33 | 65 |
|
34 | | -pacman -Q > packages/installed-packages.txt |
35 | | - |
36 | 66 | 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 |
38 | 68 | cd oolite |
39 | | - |
40 | 69 | cp .absolute_gitmodules .gitmodules |
41 | 70 | git submodule update --init |
42 | 71 | 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 |
43 | 84 |
|
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 |
47 | 114 |
|
48 | 115 | cp /mingw64/share/GNUstep/Makefiles/GNUstep.sh /etc/profile.d/ |
49 | 116 |
|
|
0 commit comments