forked from garrettjwilke/sgdk-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsgdk-setup.sh
More file actions
executable file
·128 lines (118 loc) · 2.51 KB
/
Copy pathsgdk-setup.sh
File metadata and controls
executable file
·128 lines (118 loc) · 2.51 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/usr/bin/env bash
source "$(dirname "$0")/tool-variables"
SJASM_SRC=${GDK}/Sjasm/Sjasm
SJASM_VERSION="v0.39" # for some reason this version works for x86 linux
if [ "$OS_CHECK" == "Darwin" ]
then
CORE_COUNT=$(sysctl -n hw.ncpu)
else
CORE_COUNT=$(nproc)
fi
# deps: (there might be something missing here)
# libmpc texinfo git make java makeinfo
deps_check() {
for i in "git" "make" "java" "makeinfo"
do
if [ "$(which $i)" == "" ]
then
echo "$i is not installed"
if [ "$i" == "java" ]
then
echo "install openjdk-11-jre or something like that"
elif [ "$i" == "makeinfo" ]
then
echo "install texinfo or something like that"
fi
exit
fi
done
if [ "$OS_CHECK" == "Darwin" ]
then
if [ "$(which gcc-13)" == "" ]
then
echo "brew install gcc@13"
echo "then open a new terminal"
exit
fi
fi
if [ ! -d $M68K_GCC_TOOLCHAIN ]
then
echo ""
echo "gcc toolchain not installed? build toolchain first."
echo ""
exit
fi
if [ ! -f ${M68K_GCC_TOOLCHAIN}/bin/m68k-elf-gcc ]
then
echo ""
echo "gcc toolchain not installed? build toolchain first."
echo ""
exit
fi
}
clean_build() {
if [ ! -d $BASE_BUILD_DIR ]
then
mkdir $BASE_BUILD_DIR
fi
if [ -d $GDK ]
then
rm -rf $GDK
fi
cd $BASE_BUILD_DIR
git clone https://github.com/Stephane-D/SGDK.git --depth=1
cd $GDK
git checkout $GDK_VERSION
git clone https://github.com/Konamiman/Sjasm
cd Sjasm
git checkout $SJASM_VERSION
cd $GDK
}
build_sjasm() {
cd $SJASM_SRC
make clean
if [ "$OS_CHECK" == "Darwin" ]
then
export CXX=/usr/bin/g++
export CC=/usr/bin/gcc
fi
make sjasm -j$CORE_COUNT
if [ ! -f sjasm ]
then
echo "sjasm build failed?"
exit
fi
cp sjasm ${GDK}/bin/sjasm
}
build_sgdktools() {
cd $GDK/tools/xgmtool
gcc src/*.c -Wall -O2 -lm -o xgmtool
strip xgmtool
cp xgmtool ${GDK}/bin/
cd $GDK/tools/bintos
gcc src/bintos.c -Wall -O2 -o bintos
strip bintos
cp bintos ${GDK}/bin/
cd ${GDK}/tools/convsym
make -j$CORE_COUNT
cp build/convsym ${GDK}/bin/
}
deps_check
clean_build
build_sjasm
PATH=${GDK}/bin:$PATH
build_sgdktools
PATH=${M68K_GCC_TOOLCHAIN}/bin:$PATH
cd $GDK
make -f makelib.gen clean-release
make -f makelib.gen release
make -f makelib.gen clean-debug
make -f makelib.gen debug
echo ""
echo "----------------------------------------------------"
echo "add tools to path:"
echo "${GDK}/bin"
echo ""
echo "build project with:"
echo "make -f ${GDK}/makefile.gen"
echo ""