Fixes
This commit is contained in:
		
							parent
							
								
									430ed90eaf
								
							
						
					
					
						commit
						06ada0b0dc
					
				@ -50,7 +50,7 @@ SYSROOT="$PWD/sysroot"
 | 
				
			|||||||
GCC_INTERNAL_PATH=$(dirname $(gcc -print-libgcc-file-name))
 | 
					GCC_INTERNAL_PATH=$(dirname $(gcc -print-libgcc-file-name))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cat << CEOF > sysroot.specs
 | 
					cat << CEOF > sysroot.specs
 | 
				
			||||||
*link_libgcc
 | 
					*link_libgcc:
 | 
				
			||||||
-L$SYSROOT/lib -L$SYSROOT/lib64 -L$SYSROOT/usr/lib -L$SYSROOT/usr/lib64 -L$SYSROOT/usr/local/lib -L$SYSROOT/usr/local/lib64 -L$GCC_INTERNAL_PATH
 | 
					-L$SYSROOT/lib -L$SYSROOT/lib64 -L$SYSROOT/usr/lib -L$SYSROOT/usr/lib64 -L$SYSROOT/usr/local/lib -L$SYSROOT/usr/local/lib64 -L$GCC_INTERNAL_PATH
 | 
				
			||||||
CEOF
 | 
					CEOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
SRC_DIR=$(pwd)
 | 
					SRC_DIR=$(pwd)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
. ../common.sh
 | 
					. ../../common.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Find the main source directory
 | 
					# Find the main source directory
 | 
				
			||||||
cd ../../..
 | 
					cd ../../..
 | 
				
			||||||
 | 
				
			|||||||
@ -1,24 +1,37 @@
 | 
				
			|||||||
#!/bin/sh
 | 
					#!/bin/sh
 | 
				
			||||||
# common code use by almost all bundles
 | 
					# common code used by all bundles
 | 
				
			||||||
# this should be sourced in bundle.sh of every bundle
 | 
					# should be included at the top of every *.sh file of each bundle
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Read the 'JOB_FACTOR' property from '.config'
 | 
					export MAIN_SRC_DIR=$(realpath --no-symlinks $PWD/../../../)
 | 
				
			||||||
JOB_FACTOR="$(grep -i ^JOB_FACTOR $MAIN_SRC_DIR/.config | cut -f2 -d'=')"
 | 
					export WORK_DIR="$MAIN_SRC_DIR/work"
 | 
				
			||||||
 | 
					export SRC_DIR=$(pwd)
 | 
				
			||||||
 | 
					export CONFIG="$MAIN_SRC_DIR/.config"
 | 
				
			||||||
 | 
					export SYSROOT="$WORK_DIR/sysroot"
 | 
				
			||||||
 | 
					export SYSROOT_SPECS="$WORK_DIR/sysroot.specs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Read the 'CFLAGS' property from '.config'
 | 
					# Read the 'JOB_FACTOR' property from $CONFIG
 | 
				
			||||||
CFLAGS="$(grep -i ^CFLAGS $MAIN_SRC_DIR/.config | cut -f2 -d'=')"
 | 
					export JOB_FACTOR="$(grep -i ^JOB_FACTOR $CONFIG | cut -f2 -d'=')"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Find the number of available CPU cores.
 | 
					# Read the 'CFLAGS' property from $CONFIG
 | 
				
			||||||
NUM_CORES=$(grep ^processor /proc/cpuinfo | wc -l)
 | 
					export CFLAGS="$(grep -i ^CFLAGS $CONFIG | cut -f2 -d'=')"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Calculate the number of 'make' jobs to be used later.
 | 
					# Find the number of available CPU cores
 | 
				
			||||||
NUM_JOBS=$((NUM_CORES * JOB_FACTOR))
 | 
					export NUM_CORES="$(grep ^processor /proc/cpuinfo | wc -l)"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# sysroot
 | 
					# Calculate the number of make "jobs"
 | 
				
			||||||
 | 
					export NUM_JOBS=$((NUM_CORES * JOB_FACTOR))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# some of these are duplicate, but there are always bad packages that ignore one of these
 | 
					# Ideally we would export MAKE at this point with -j etc to allow programs to just run $(MAKE) and not worry about extra flags that need to be passed
 | 
				
			||||||
SPECS=$PWD/../../../work/sysroot.specs
 | 
					#  export MAKE="${MAKE-make} -j $NUM_JOBS"
 | 
				
			||||||
CC="gcc -specs=$SPECS -static-libgcc -Wl,-nostdlib"
 | 
					
 | 
				
			||||||
CFLAGSC="-specs=$SPECS -static-libgcc $CFLAGS -Wl,-nostdlib"
 | 
					# sysroot flags for the compiler
 | 
				
			||||||
CPPFLAGS="-specs=$SPECS -static-libgcc $CPPFLAGS -Wl,-nostdlib"
 | 
					
 | 
				
			||||||
LDFLAGS="-Wl,-nostdlib $(grep -- \"-L\" $SPECS)"
 | 
					#-Wl,-nostdlib is required to make ld / gcc ignore the host's /usr/lib and /lib
 | 
				
			||||||
 | 
					ld_flags="-Wl,-nostdlib $(grep -- \"-L\" $SYSROOT_SPECS)"
 | 
				
			||||||
 | 
					#-static-libgcc is neeeded since we don't have the gcc-libs in our sysroot
 | 
				
			||||||
 | 
					gcc_flags="-specs=$SYSROOT_SPECS -static-libgcc"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# $ld_flags is passed 2 times because sometimes bundles ignore one of the variables
 | 
				
			||||||
 | 
					export CC="${CC-gcc} $gcc_flags $ld_flags"
 | 
				
			||||||
 | 
					export CFLAGS="$CFLAGS"
 | 
				
			||||||
 | 
					export LDFLAGS="$LDFLAGS $ld_flags"
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user