Blame win/function.sh

87fe10
#!/bin/bash
87fe10
87fe10
87fe10
function print_section() {
87fe10
	echo "-----------------------"
87fe10
	echo "   $1"
87fe10
	echo "-----------------------"
87fe10
}
87fe10
87fe10
87fe10
function echocall() {
87fe10
	echo "$@"
87fe10
	"$@"
87fe10
}
87fe10
87fe10
87fe10
function unpacklib() {
87fe10
	local lib=$1
87fe10
	mkdir -p $lib
87fe10
	cd $lib
87fe10
	echocall $AR -x "$prefix/lib/lib$lib.a"
87fe10
	cd ..
87fe10
}
87fe10
87fe10
87fe10
function download() {
87fe10
	mkdir -p download
87fe10
	cd download
87fe10
	for package in $packages; do
87fe10
		if [ ! -f "$package.done" ]; then
87fe10
			print_section "download $package"
87fe10
			local vu=url_$package
87fe10
			local vt=tar_$package
87fe10
			local vs=sha_$package
87fe10
			wget -c "${!vu}"
87fe10
			echo "${!vs} ${!vt}" | sha256sum -c
87fe10
			touch "$package.done"
87fe10
		fi
87fe10
	done
87fe10
	cd ..
87fe10
}
87fe10
87fe10
87fe10
function unpack() {
87fe10
	mkdir -p unpack
87fe10
	cd unpack
87fe10
	for package in $packages; do
87fe10
		if [ ! -f "$package.done" ]; then
87fe10
			print_section "unpack $package"
87fe10
			local v=tar_$package
87fe10
			tar -xf ../download/${!v}
87fe10
			touch "$package.done"
87fe10
		fi
87fe10
	done
87fe10
	cd ..
87fe10
}
87fe10
87fe10
87fe10
function build() {
87fe10
	bits=$1
87fe10
	host=$2
87fe10
87fe10
	toolchain $host
1b8859
	prefix="$ROOT/usr-$bits"
1b8859
	export CFLAGS="$ADDCFLAGS -I$prefix/include"
87fe10
	export CPPFLAGS="-I$prefix/include"
87fe10
	export LDFLAGS="-L$prefix/lib"
87fe10
	export PKG_CONFIG_PATH="$prefix/lib/pkgconfig"
87fe10
	export PKG_CONFIG_LIBDIR="$prefix/lib/pkgconfig"
87fe10
1b8859
	mkdir -p build-$bits
1b8859
	cd build-$bits
87fe10
	for package in $packages $newpackages; do
87fe10
		if [ ! -f "$package.done" ]; then
1b8859
			print_section "build-$bits $package"
87fe10
			local v=dir_$package
87fe10
			srcdir="$ROOT/unpack/${!v}"
87fe10
87fe10
			mkdir -p $package
87fe10
			cd $package
87fe10
			build_$package
87fe10
			cd ..
87fe10
87fe10
			touch "$package.done"
87fe10
		fi
87fe10
	done
87fe10
	cd ..
87fe10
}
87fe10