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)
194194if [ ! -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
196206else
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
216226fi
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-
230228echo " building FB-$target (uname = ` uname` , uname -m = ` uname -m` )"
231229echo " from repository: https://github.com/freebasic/fbc.git"
232230if [ ! -z " $user_recipe " ]; then
@@ -279,11 +277,8 @@ cd ../..
279277
280278cd 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 "
287282echo " fbc $fbccommit $target , build based on:" > $buildinfo
288283echo " named recipe: $named_recipe " >> $buildinfo
289284echo >> $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