diff --git a/ports/.gitignore b/ports/.gitignore index 0b53aeb0..cf7a405e 100644 --- a/ports/.gitignore +++ b/ports/.gitignore @@ -1,3 +1,4 @@ */* !*/patches/ !*/build.sh +.installed_ports diff --git a/ports/install.sh b/ports/install.sh index f30e9d2e..3741b28c 100755 --- a/ports/install.sh +++ b/ports/install.sh @@ -11,6 +11,12 @@ fi source "$BANAN_ROOT_DIR/script/config.sh" +installed_file="$BANAN_PORT_DIR/.installed_ports" +if [ -z $DONT_REMOVE_INSTALLED ]; then + export DONT_REMOVE_INSTALLED=1 + rm -f "$installed_file" +fi + export PATH="$BANAN_TOOLCHAIN_PREFIX/bin:$PATH" export PKG_CONFIG_DIR='' @@ -29,10 +35,6 @@ export OBJDUMP="$BANAN_TOOLCHAIN_TRIPLE-objdump" export STRIP="$BANAN_TOOLCHAIN_TRIPLE-strip" export CXXFILT="$BANAN_TOOLCHAIN_TRIPLE-c++filt" -pushd "$BANAN_ROOT_DIR" >/dev/null -./bos all && ./bos install || exit 1 -popd >/dev/null - if [ "$BANAN_ARCH" = "i686" ]; then export LDFLAGS="-shared-libgcc" fi @@ -78,13 +80,17 @@ post_configure() { } configure() { - pre_configure - configure_options=("--host=$BANAN_ARCH-pc-banan_os" '--prefix=/usr') configure_options+=("${CONFIGURE_OPTIONS[@]}") ./configure "${configure_options[@]}" || exit 1 +} - post_configure +pre_build() { + : +} + +post_build() { + : } build() { @@ -102,13 +108,9 @@ post_install() { } install() { - pre_install - for target in "${MAKE_INSTALL_TARGETS[@]}"; do make $target "DESTDIR=$BANAN_SYSROOT" || exit 1 done - - post_install } source $1 @@ -118,7 +120,30 @@ if [ -z $NAME ] || [ -z $VERSION ] || [ -z $DOWNLOAD_URL ]; then exit 1 fi +build_dir="$NAME-$VERSION-$BANAN_ARCH" + +if [ ! -d "$build_dir" ]; then + rm -f '.compile_hash' +fi + +if [ ! -f '.compile_hash' ] && [ -f "$installed_file" ]; then + sed -i "/^$NAME-$VERSION$/d" "$installed_file" +fi + +if grep -qsxF "$NAME-$VERSION" "$installed_file"; then + exit 0 +fi + +pushd "$BANAN_ROOT_DIR" >/dev/null +./bos all && ./bos install || exit 1 +popd >/dev/null + for dependency in "${DEPENDENCIES[@]}"; do + if [ ! -d "../$dependency" ]; then + echo "Could not find dependency '$dependency' or port '$NAME'" + exit 1 + fi + pushd "../$dependency" >/dev/null pwd if ! ./build.sh; then @@ -128,12 +153,6 @@ for dependency in "${DEPENDENCIES[@]}"; do popd >/dev/null done -build_dir="$NAME-$VERSION-$BANAN_ARCH" - -if [ ! -d "$build_dir" ]; then - rm -f ".compile_hash" -fi - if [ "$VERSION" = "git" ]; then regex="(.*/.*\.git)#(.*)" @@ -186,7 +205,7 @@ else exit 1 fi - regex='(.*\.tar\..*)' + regex='(.*\.tar\..*|.*\.tgz)' if [[ $FILE_NAME =~ $regex ]] && [ ! -d "$build_dir" ]; then tar xf "$FILE_NAME" || exit 1 @@ -219,9 +238,19 @@ cd "$build_dir" if (( $needs_compile )); then config_sub_update + + pre_configure configure + post_configure + + pre_build build + post_build + sha256sum "$BANAN_SYSROOT/usr/lib/libc.a" > "../.compile_hash" fi +pre_install install +grep -qsxF "$NAME-$VERSION" "$installed_file" || echo "$NAME-$VERSION" >> "$installed_file" +post_install