Skip to content

Commit ee29f17

Browse files
committed
Small improvements to the make-release script.
- Create the output directory if not exists, - Use the sample template for both manuals, - Don't compile for OSX or WIN32 if the compilers are missing. This fixes #103.
1 parent 3ed031f commit ee29f17

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

make-release.sh

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@ out="$rdir/fastbasic-$ver"
2121
LTO_FLAGS="-flto -flto-partition=none"
2222
CXX_FLAGS="-DNDEBUG -Os -Wall"
2323
LIN64_FLAGS="$CXX_FLAGS $LTO_FLAGS -static-libstdc++ -Wl,--gc-sections"
24+
WIN_CROSS=i686-w64-mingw32-
2425
WIN_FLAGS="$CXX_FLAGS -static -Wl,--gc-sections"
26+
OSX64_CROSS=x86_64-apple-darwin20.2-
2527
OSX64_FLAGS="$CXX_FLAGS -flto -static-libstdc++"
2628

29+
# Make output folder if not exists
30+
mkdir -p "$rdir"
31+
2732
echo "----------- Compiling release $ver -------------"
2833
echo ""
2934

@@ -36,21 +41,40 @@ compile_lin64() {
3641
}
3742

3843
compile_win32() {
44+
if ! which "${WIN_CROSS}gcc" > /dev/null ; then
45+
echo "-----------------------------------------------------"
46+
echo "--"
47+
echo "-- ERROR: missing windows compiler ${WIN_CROSS}gcc"
48+
echo "--"
49+
echo "-----------------------------------------------------"
50+
return
51+
fi
52+
3953
# Compile with mingw-w64 cross compiler to 32bit:
40-
make $ncpu CROSS=i686-w64-mingw32- TARGET_OPTFLAGS="$WIN_FLAGS" build/fastbasic.zip
54+
make $ncpu CROSS="$WIN_CROSS" TARGET_OPTFLAGS="$WIN_FLAGS" build/fastbasic.zip
4155
mv build/fastbasic.zip "${out}-win32.zip"
42-
make CROSS=i686-w64-mingw32- distclean
56+
make CROSS="$WIN_CROSS" distclean
4357
}
4458

4559
compile_osx() {
4660
OPATH="$PATH"
4761
PATH="$PATH:/opt/osx/bin"
62+
63+
if ! which "${OSX64_CROSS}cc" > /dev/null ; then
64+
echo "-----------------------------------------------------"
65+
echo "--"
66+
echo "-- ERROR: missing OSX compiler ${OSX64_CROSS}cc"
67+
echo "--"
68+
echo "-----------------------------------------------------"
69+
return
70+
fi
4871
# Compile FAT binary for OSX.
4972
# Note that this is simpler with CLANG, but it produces a binary slower and twice the size!
5073
# First compile to 64bit:
51-
make $ncpu CROSS=x86_64-apple-darwin20.2- CC=cc CXX=c++ TARGET_OPTFLAGS="$OSX64_FLAGS" build/fastbasic.zip
74+
make $ncpu CROSS="$OSX64_CROSS" CC=cc CXX=c++ TARGET_OPTFLAGS="$OSX64_FLAGS" \
75+
build/fastbasic.zip
5276
mv build/fastbasic.zip "${out}-macosx.zip"
53-
make CROSS=x86_64-apple-darwin20.2- CC=cc CXX=c++ distclean
77+
make CROSS="$OSX64_CROSS" CC=cc CXX=c++ distclean
5478
PATH="$OPATH"
5579
}
5680

@@ -68,5 +92,5 @@ pandoc build/compiler/MANUAL.md -o "${out}-manual.pdf" \
6892

6993
make build/compiler/USAGE.md
7094
pandoc build/compiler/USAGE.md -o "${out}-cross-compiler.pdf" \
71-
--from markdown-raw_tex --template ~/eisvogel.tex --listings
95+
--from markdown-raw_tex --template template.tex --listings
7296

0 commit comments

Comments
 (0)