-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanual-build.sh
executable file
·62 lines (49 loc) · 1.89 KB
/
manual-build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
if [[ "$1" =~ ^clean$ ]]; then
rm -rf nes-dependencies-*
exit
fi
if [ "$1" == "" ] || [ $# -gt 1 ]; then
echo "Parameters are missing!"
echo "Allowed parameters: \"clean\" or a triplet"
echo "Allowed triplets: (x64 || arm64)-(osx || linux)"
exit
fi
if [[ ! "$1" =~ ^(x64|arm64)-(osx|linux)$ ]]; then
echo "$1 is not allowed as triplet!"
exit
fi
if ! command -v 7z &> /dev/null
then
echo "7z could not be found, please install!"
exit
fi
echo "Chosen triplet: $1-nes"
export VCPKG_FEATURE_FLAGS="-binarycaching"
if [[ "$1" =~ ^arm64.*$ ]]; then
echo "ARM64 detected, using system binaries..."
export VCPKG_FORCE_SYSTEM_BINARIES=1
if ! command -v ninja &> /dev/null
then
echo "ninja could not be found, please install!"
exit
fi
fi
# Sometimes this issue appears: https://github.com/microsoft/vcpkg/issues/22812.
# Setting this variable to true should quickly fix the path resolution error:
vcpkg_path_fix=false
if [ "$vcpkg_path_fix" = true ] ; then
sed -i '32i string(REPLACE "\:" "" lst "${lst}")' $(dirname $0)/vcpkg/scripts/cmake/vcpkg_host_path_list.cmake
fi
$(dirname $0)/vcpkg/bootstrap-vcpkg.sh -disableMetrics
$(dirname $0)/vcpkg/vcpkg install --triplet="$1-nes" --host-triplet="$1-nes" --overlay-triplets=custom-triplets/ --overlay-ports=vcpkg-registry/ports/
mkdir $(dirname $0)/nes-dependencies-$1-nes && \
mv $(dirname $0)/vcpkg_installed nes-dependencies-$1-nes/installed && \
mkdir -p $(dirname $0)/nes-dependencies-$1-nes/scripts/buildsystems && \
cp $(dirname $0)/vcpkg/scripts/buildsystems/vcpkg.cmake $(dirname $0)/nes-dependencies-$1-nes/scripts/buildsystems/ && \
touch $(dirname $0)/nes-dependencies-$1-nes/.vcpkg-root && \
7z a nes-dependencies-$1-nes.7z nes-dependencies-$1-nes -mx9 -aoa
# Clean up the fix
if [ "$vcpkg_path_fix" = true ] ; then
sed -i '32d' $(dirname $0)/vcpkg/scripts/cmake/vcpkg_host_path_list.cmake
fi