Skip to content

Commit a647b95

Browse files
committed
contrib/release/build.sh: remove downloaded package
- remove a downloaded package if there was an error unpacking it - fix the bootstrap package for debian12-arm build - clean-up whitespace in build scripts - wip to manage the recipe name - the idea is that the "recipe" used controls some attributes of the build, like package name when built on different platforms, but defaults for fbc itself (e.g. -target linux) should still work the same as if no recipe was specified
1 parent 1a79e6f commit a647b95

File tree

2 files changed

+55
-66
lines changed

2 files changed

+55
-66
lines changed

contrib/release/build-bsd.sh

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
#
4646
# Requirements:
4747
# - gmake and other gnu tools
48-
#
48+
#
4949
set -e
5050

5151
usage() {
@@ -120,13 +120,22 @@ fi
120120
# recipe_name is from the command line option, empty string if not given
121121
# user_recipe is either explicit (from command line) or automatic (below)
122122
if [ ! -z "$recipe_name" ]; then
123-
user_recipe=$recipe_name
123+
# recipe_name may be blank and optionally start with a dash '-'
124+
# user_recipe must be blank or start with a dash '-'
125+
case "$recipe_name" in
126+
""|-*)
127+
user_recipe=$recipe_name
128+
;;
129+
*)
130+
user_recipe=-$recipe_name
131+
;;
132+
esac
124133
else
125134
# if no recipe given, set the default recipe for the main package
126135
user_recipe=
127136
case "$target" in
128137
win32|win64)
129-
user_recipe=-winlibs-gcc-9.3.0
138+
named_recipe=-winlibs-gcc-9.3.0
130139
;;
131140
linux-arm)
132141
# named recipe wasn't given, try and figure it out ...
@@ -136,25 +145,13 @@ else
136145
fi
137146
case "$host_os_id-$host_os_ver" in
138147
raspbian-9)
139-
user_recipe=raspbian9-arm
148+
named_recipe=-raspbian9-arm
140149
;;
141150
esac
142151
;;
143152
esac
144153
fi
145154

146-
# user_recipe may be blank and optionally start with a dash '-'
147-
# named_recipe must be blank or start with a dash '-'
148-
149-
case "$user_recipe" in
150-
""|-*)
151-
named_recipe=$user_recipe
152-
;;
153-
*)
154-
named_recipe=-$user_recipe
155-
;;
156-
esac
157-
158155
echo "building FB-$target (uname = `uname`, uname -m = `uname -m`)"
159156
echo "from repository: https://github.com/freebasic/fbc.git"
160157
if [ ! -z "$user_recipe" ]; then
@@ -207,11 +204,8 @@ cd ../..
207204

208205
cd build
209206

210-
if [ ! -z "$named_recipe" ] ; then
211-
buildinfo=../output/buildinfo$named_recipe.txt
212-
else
213-
buildinfo=../output/buildinfo-$target.txt
214-
fi
207+
buildinfo=../output/buildinfo-$target$user_recipe.txt
208+
echo "buildinfo: $buildinfo"
215209
echo "fbc $fbccommit $target, build based on:" > $buildinfo
216210
echo "named recipe: $named_recipe" >> $buildinfo
217211
echo >> $buildinfo
@@ -267,7 +261,7 @@ AppendBOOTFBCFLAGS() {
267261
else
268262
BUILD_BOOTFBCFLAGS="$BUILD_BOOTFBCFLAGS $1"
269263
fi
270-
fi
264+
fi
271265
}
272266

273267
# choose a bootstrap source for the target

contrib/release/build.sh

Lines changed: 39 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,23 @@ fi
192192
# recipe_name is from the command line option, empty string if not given
193193
# user_recipe is either explicit (from command line) or automatic (below)
194194
if [ ! -z "$recipe_name" ]; then
195-
user_recipe=$recipe_name
195+
# recipe_name may be blank and optionally start with a dash '-'
196+
# user_recipe must be blank or start with a dash '-'
197+
case "$recipe_name" in
198+
""|-*)
199+
user_recipe=$recipe_name
200+
;;
201+
*)
202+
user_recipe=-$recipe_name
203+
;;
204+
esac
205+
named_recipe=$user_recipe
196206
else
197207
# if no recipe given, set the default recipe for the main package
198208
user_recipe=
199209
case "$target" in
200210
win32|win64)
201-
user_recipe=-winlibs-gcc-9.3.0
211+
named_recipe=-winlibs-gcc-9.3.0
202212
;;
203213
linux-arm)
204214
# named recipe wasn't given, try and figure it out ...
@@ -208,25 +218,13 @@ else
208218
fi
209219
case "$host_os_id-$host_os_ver" in
210220
raspbian-9)
211-
user_recipe=raspbian9-arm
221+
named_recipe=-raspbian9-arm
212222
;;
213223
esac
214224
;;
215225
esac
216226
fi
217227

218-
# user_recipe may be blank and optionally start with a dash '-'
219-
# named_recipe must be blank or start with a dash '-'
220-
221-
case "$user_recipe" in
222-
""|-*)
223-
named_recipe=$user_recipe
224-
;;
225-
*)
226-
named_recipe=-$user_recipe
227-
;;
228-
esac
229-
230228
echo "building FB-$target (uname = `uname`, uname -m = `uname -m`)"
231229
echo "from repository: https://github.com/freebasic/fbc.git"
232230
if [ ! -z "$user_recipe" ]; then
@@ -279,11 +277,8 @@ cd ../..
279277

280278
cd build
281279

282-
if [ ! -z "$named_recipe" ] ; then
283-
buildinfo=../output/buildinfo$named_recipe.txt
284-
else
285-
buildinfo=../output/buildinfo-$target.txt
286-
fi
280+
buildinfo=../output/buildinfo-$target$user_recipe.txt
281+
echo "buildinfo: $buildinfo"
287282
echo "fbc $fbccommit $target, build based on:" > $buildinfo
288283
echo "named recipe: $named_recipe" >> $buildinfo
289284
echo >> $buildinfo
@@ -734,7 +729,7 @@ AppendBOOTFBCFLAGS() {
734729
else
735730
BUILD_BOOTFBCFLAGS="$BUILD_BOOTFBCFLAGS $1"
736731
fi
737-
fi
732+
fi
738733
}
739734

740735
# choose a bootstrap source for the target
@@ -749,7 +744,7 @@ case "$named_recipe" in
749744
# but it requires some manual intervention to set compile options
750745
#
751746
AppendBOOTFBCFLAGS "DEFAULT_CPUTYPE_ARM=FB_CPUTYPE_ARMV7A_FP"
752-
bootfb_title="FreeBASIC-1.10.2-$fbtarget"
747+
bootfb_title="FreeBASIC-1.10.2$named_recipe"
753748
;;
754749
-raspbian9-arm)
755750
AppendBOOTFBCFLAGS "DEFAULT_CPUTYPE_ARM=FB_CPUTYPE_ARMV6"
@@ -782,7 +777,7 @@ linux*)
782777
# Download & extract FB for bootstrapping
783778
bootfb_package=$bootfb_title.tar.xz
784779
download $bootfb_package "https://downloads.sourceforge.net/fbc/${bootfb_package}?download"
785-
tar xf ../input/$bootfb_package
780+
tar xf ../input/$bootfb_package || rm -f ../input/$bootfb_package
786781

787782
# fbc sources
788783
cp -R ../input/fbc .
@@ -794,7 +789,7 @@ linux*)
794789
# Download & extract FB for bootstrapping
795790
bootfb_package=$bootfb_title.zip
796791
download $bootfb_package "https://downloads.sourceforge.net/fbc/${bootfb_package}?download"
797-
unzip -q ../input/$bootfb_package
792+
unzip -q ../input/$bootfb_package || rm -f ../input/$bootfb_package
798793

799794
# fbc sources
800795
cp -R ../input/fbc fbc
@@ -834,10 +829,10 @@ case "$named_recipe" in
834829
# older mingw-w64 packages are distributed with headers for libffi-3.2.1
835830
# but libffi-3.3 below should work for them also
836831
#-mingw-w64-gcc-5.2.0|-gcc-5.2.0|-mingw-w64-gcc-8.1.0|-gcc-8.1.0)
837-
# # libffi sources https://github.com/libffi/libffi/releases/download/v3.3/libffi-3.2.1.tar.gz.
838-
# libffi_version="3.2.1"
839-
# libffi_dir="https://github.com/libffi/libffi/releases/download/v${libffi_version}"
840-
# ;;
832+
# # libffi sources https://github.com/libffi/libffi/releases/download/v3.3/libffi-3.2.1.tar.gz.
833+
# libffi_version="3.2.1"
834+
# libffi_dir="https://github.com/libffi/libffi/releases/download/v${libffi_version}"
835+
# ;;
841836
-mingw-w64-gcc-5.2.0|-gcc-5.2.0)
842837
# - https://github.com/libffi/libffi/releases/download/v3.3/libffi-3.3.tar.gz.
843838
libffi_version="3.3"
@@ -975,15 +970,15 @@ libffibuild() {
975970
# we might copy in the files directly if we unable to build libffi ourselves
976971
# as was the case for libffi-3.2.1 and some gcc tool chains
977972
# so just leave this section commented out for reference
978-
# case "$named_recipe" in
979-
# -gcc-7.1.0|-gcc-7.1.0r0|-gcc-7.1.0r2|-gcc-7.3.0|-gcc-8.1.0)
980-
# mkdir -p ../input/$libffi_title/$target$named_recipe
981-
# cp opt/lib/libffi-3.3/include/ffi.h ../input/$libffi_title/$target$named_recipe
982-
# cp opt/lib/libffi-3.3/include/ffitarget.h ../input/$libffi_title/$target$named_recipe
983-
# cp opt/lib/libffi.a ../input/$libffi_title/$target$named_recipe
984-
# return
985-
# ;;
986-
# esac
973+
# case "$named_recipe" in
974+
# -gcc-7.1.0|-gcc-7.1.0r0|-gcc-7.1.0r2|-gcc-7.3.0|-gcc-8.1.0)
975+
# mkdir -p ../input/$libffi_title/$target$named_recipe
976+
# cp opt/lib/libffi-3.3/include/ffi.h ../input/$libffi_title/$target$named_recipe
977+
# cp opt/lib/libffi-3.3/include/ffitarget.h ../input/$libffi_title/$target$named_recipe
978+
# cp opt/lib/libffi.a ../input/$libffi_title/$target$named_recipe
979+
# return
980+
# ;;
981+
# esac
987982

988983
echo
989984
echo "building libffi"
@@ -1080,11 +1075,11 @@ windowsbuild() {
10801075
cd ..
10811076

10821077
mkdir -p fbc/bin/$fbtarget
1083-
cp bin/ar.exe fbc/bin/$fbtarget
1084-
cp bin/as.exe fbc/bin/$fbtarget
1085-
cp bin/dlltool.exe fbc/bin/$fbtarget
1086-
cp bin/gprof.exe fbc/bin/$fbtarget
1087-
cp bin/ld.exe fbc/bin/$fbtarget
1078+
cp bin/ar.exe fbc/bin/$fbtarget
1079+
cp bin/as.exe fbc/bin/$fbtarget
1080+
cp bin/dlltool.exe fbc/bin/$fbtarget
1081+
cp bin/gprof.exe fbc/bin/$fbtarget
1082+
cp bin/ld.exe fbc/bin/$fbtarget
10881083

10891084
case "$named_recipe" in
10901085
-equation-gcc-8.3.0)
@@ -1121,7 +1116,7 @@ windowsbuild() {
11211116
# libgcc_s_sjlj-1.dll - SJLJ win32 or win53
11221117
# libgcc_s_dw2.dll - dwarf2 win32
11231118
# libgcc_s_seh.dll - SEH win64
1124-
cp bin/libgcc_s_*-1.dll fbc/bin/$fbtarget
1119+
cp bin/libgcc_s_*-1.dll fbc/bin/$fbtarget
11251120

11261121
case "$target" in
11271122
win32)
@@ -1195,7 +1190,7 @@ windowsbuild() {
11951190
cd fbc
11961191
case "$target" in
11971192
win32|win64)
1198-
make bindist DISABLE_DOCS=1 FBPACKSUFFIX=$named_recipe FBSHA1=$FBSHA1
1193+
make bindist DISABLE_DOCS=1 FBPACKSUFFIX=$user_recipe FBSHA1=$FBSHA1
11991194
make bindist ENABLE_STANDALONE=1 FBPACKSUFFIX=$user_recipe FBSHA1=$FBSHA1
12001195
;;
12011196
win32-mingworg)

0 commit comments

Comments
 (0)