1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
10 if [[ $NO_ERROR != @
(0|
1) ]]; then
11 echo Please
do not invoke this
script directly
!
26 ERROR: OpenADK cannot be built in a case-insensitive file system.
30 echo "Building OpenADK on $os needs a small registry change."
31 echo 'http://cygwin.com/cygwin-ug-net/using-specialnames.html'
34 echo "Building OpenADK on $os needs a case-sensitive disk partition."
35 echo "For Snow Leopard and above you can use diskutil to resize your existing disk."
36 echo "Example: sudo diskutil resizeVolume disk0s2 90G 1 jhfsx adk 30G"
37 echo "For older versions you might consider to use a disk image:"
38 echo "hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 30g ~/openadk.dmg"
57 if ! which gmake
>/dev
/null
2>&1; then
58 echo You must
install GNU
make to
continue.
68 echo "Building OpenADK on $os is currently unsupported."
76 if [ -z $
(which gmake
2>/dev
/null
) ];then
77 makecmd
=$
(which make 2>/dev
/null
)
79 makecmd
=$
(which gmake
2>/dev
/null
)
83 include ${ADK_TOPDIR}/prereq.mk
87 ${HOST_CC} ${HOST_CFLAGS} -o $@ $^ ${LDADD}
97 printf("Yay! Native compiler works.\n");
101 if [[ $clang -eq 0 ]]; then
102 X
=$
($makecmd ADK_TOPDIR
=$topdir LDADD
=-lgcc 2>&1)
103 if [[ $X != *@
(Native compiler works
)* ]]; then
104 echo Cannot compile with shared libgcc use static one.
105 HOST_CFLAGS
=-static-libgcc
106 echo "HOST_CFLAGS:=-O0 -g0 -static-libgcc" >> $topdir/prereq.mk
107 echo "HOST_CXXFLAGS:=-O0 -g0 -static-libgcc" >> $topdir/prereq.mk
109 echo "HOST_CFLAGS:=-O0 -g0" >> $topdir/prereq.mk
110 echo "HOST_CXXFLAGS:=-O0 -g0" >> $topdir/prereq.mk
113 echo "HOST_CFLAGS:=-O0 -g0" >> $topdir/prereq.mk
114 echo "HOST_CXXFLAGS:=-O0 -g0" >> $topdir/prereq.mk
117 X
=$
($makecmd ADK_TOPDIR
=$topdir HOST_CFLAGS
=${HOST_CFLAGS} 2>&1)
118 if [[ $X != *@
(Native compiler works
)* ]]; then
119 echo "$X" |
sed 's/^/| /'
120 echo Cannot compile a simple
test programme.
121 echo You must
install a
host make and C compiler
,
122 echo usually GCC
, to proceed.
128 if ! which shasum
>/dev
/null
2>&1; then
129 if ! which sha256sum
>/dev
/null
2>&1; then
130 if ! which cksum >/dev
/null
2>&1; then
131 echo You must
install shasum or sha256sum or
cksum to
continue.
138 if ! which gzip >/dev
/null
2>&1; then
139 echo You must
install gzip to
continue.
149 #define STDIN_FILENO 0
159 zstdin = gzdopen(STDIN_FILENO, "rb");
160 i = gzread(zstdin, buf, sizeof (buf));
161 if ((i > 0) && (i < sizeof (buf)))
163 buf[sizeof (buf) - 1] = '\0';
168 X
=$
(echo 'Yay! Native compiler works.' |
gzip | \
169 $makecmd ADK_TOPDIR
=$topdir LDADD
=-lz HOST_CFLAGS
=${HOST_CFLAGS} 2>&1)
170 if [[ $X != *@
(Native compiler works
)* ]]; then
171 echo "$X" |
sed 's/^/| /'
172 echo Cannot compile a libz
test programm.
173 echo You must
install the zlib development package
,
174 echo usually called libz-dev
, and the run-time library.
179 if [[ ! -s /usr
/include
/ncurses.h
]]; then
180 if [[ ! -s /usr
/include
/curses.h
]]; then
181 if [[ ! -s /usr
/include
/ncurses
/ncurses.h
]]; then
182 if [[ ! -s /usr
/local
/opt
/ncurses
/include
/ncursesw
/ncurses.h
]]; then
183 echo Install ncurses header files
, please.
191 if ! which wget
>/dev
/null
2>&1; then
192 echo You must
install wget to
continue.
197 if ! which perl
>/dev
/null
2>&1; then
198 echo You must
install perl to
continue.
203 if ! which g
++ >/dev
/null
2>&1; then
204 echo "You need a C++ compiler to continue."
209 # always required, but can be provided by host
211 if which bc >/dev
/null
2>&1; then
212 if ! echo quit|
bc -q 2>/dev
/null
>/dev
/null
;then
220 if ! which bison
>/dev
/null
2>&1; then
225 if ! which bzip2 >/dev
/null
2>&1; then
230 if ! which file >/dev
/null
2>&1; then
235 if ! which flex
>/dev
/null
2>&1; then
240 if ! which m4 >/dev
/null
2>&1; then
245 if ! which mksh
>/dev
/null
2>&1; then
250 if ! which patch >/dev
/null
2>&1; then
255 if ! which pkgconf
>/dev
/null
2>&1; then
260 if which tar >/dev
/null
2>&1; then
261 if ! tar --version 2>/dev
/null|
grep GNU
>/dev
/null
;then
268 host_build_findutils
=0
269 if ! which gxargs
>/dev
/null
2>&1; then
270 if which xargs >/dev
/null
2>&1; then
271 if ! xargs --version 2>/dev
/null|
grep GNU
>/dev
/null
;then
272 host_build_findutils
=1
277 if ! which gfind
>/dev
/null
2>&1; then
278 if which find >/dev
/null
2>&1; then
279 if ! find --version 2>/dev
/null|
grep GNU
>/dev
/null
;then
280 host_build_findutils
=1
286 if which grep >/dev
/null
2>&1; then
287 if ! grep --version 2>/dev
/null|
grep GNU
>/dev
/null
;then
293 if ! which gawk
>/dev
/null
2>&1; then
298 if ! which gsed
>/dev
/null
2>&1; then
299 if which sed >/dev
/null
2>&1; then
300 if ! sed --version 2>/dev
/null|
grep GNU
>/dev
/null
;then
307 if ! which xz
>/dev
/null
2>&1; then
312 host_build_cdrtools
=0
313 if ! which mkisofs
>/dev
/null
2>&1; then
314 host_build_cdrtools
=1
318 if ! which ccache
>/dev
/null
2>&1; then
322 host_build_genext2fs
=0
323 if ! which genext2fs
>/dev
/null
2>&1; then
324 host_build_genext2fs
=1
328 if ! which lzma
>/dev
/null
2>&1; then
333 if ! which lz4c
>/dev
/null
2>&1; then
338 if ! which lzop
>/dev
/null
2>&1; then
343 if ! which qemu-img
>/dev
/null
2>&1; then
347 echo "config ADK_HOST_BUILD_TOOLS" > $topdir/target
/config
/Config.
in.prereq
348 printf "\t%s\n" "bool" >> $topdir/target
/config
/Config.
in.prereq
349 printf "\t%s\n" "default y" >> $topdir/target
/config
/Config.
in.prereq
351 if [ $host_build_bc -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_BC" >> $topdir/target
/config
/Config.
in.prereq
;fi
352 if [ $host_build_bison -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_BISON" >> $topdir/target
/config
/Config.
in.prereq
;fi
353 if [ $host_build_bzip2 -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_BZIP2" >> $topdir/target
/config
/Config.
in.prereq
;fi
354 if [ $host_build_file -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_FILE" >> $topdir/target
/config
/Config.
in.prereq
;fi
355 if [ $host_build_flex -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_FLEX" >> $topdir/target
/config
/Config.
in.prereq
;fi
356 if [ $host_build_gawk -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_GAWK" >> $topdir/target
/config
/Config.
in.prereq
;fi
357 if [ $host_build_grep -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_GREP" >> $topdir/target
/config
/Config.
in.prereq
;fi
358 if [ $host_build_m4 -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_M4" >> $topdir/target
/config
/Config.
in.prereq
;fi
359 if [ $host_build_mksh -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_MKSH" >> $topdir/target
/config
/Config.
in.prereq
;fi
360 if [ $host_build_patch -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_PATCH" >> $topdir/target
/config
/Config.
in.prereq
;fi
361 if [ $host_build_pkgconf -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_PKGCONF" >> $topdir/target
/config
/Config.
in.prereq
;fi
362 if [ $host_build_findutils -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_FINDUTILS" >> $topdir/target
/config
/Config.
in.prereq
;fi
363 if [ $host_build_sed -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_SED" >> $topdir/target
/config
/Config.
in.prereq
;fi
364 if [ $host_build_tar -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_TAR" >> $topdir/target
/config
/Config.
in.prereq
;fi
365 if [ $host_build_xz -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_XZ" >> $topdir/target
/config
/Config.
in.prereq
;fi
367 if [ $host_build_ccache -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_CCACHE if ADK_HOST_NEED_CCACHE" >> $topdir/target
/config
/Config.
in.prereq
;fi
368 if [ $host_build_cdrtools -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_CDRTOOLS if ADK_HOST_NEED_CDRTOOLS" >> $topdir/target
/config
/Config.
in.prereq
;fi
369 if [ $host_build_genext2fs -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_GENEXT2FS if ADK_HOST_NEED_GENEXT2FS" >> $topdir/target
/config
/Config.
in.prereq
;fi
370 if [ $host_build_lzma -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_LZMA if ADK_HOST_NEED_LZMA" >> $topdir/target
/config
/Config.
in.prereq
;fi
371 if [ $host_build_lz4 -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_LZ4 if ADK_HOST_NEED_LZ4" >> $topdir/target
/config
/Config.
in.prereq
;fi
372 if [ $host_build_lzop -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_LZOP if ADK_HOST_NEED_LZOP" >> $topdir/target
/config
/Config.
in.prereq
;fi
373 if [ $host_build_qemu -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_QEMU if ADK_HOST_NEED_QEMU" >> $topdir/target
/config
/Config.
in.prereq
;fi