From 5aca6c7c1f9ba1f97c6922dc588778e2b696f78e Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 6 Aug 2024 16:07:02 +0300 Subject: [PATCH] Ports: Fix bugs in the port system Fix some bugs and add pkg-config for the port system. Also ncurses is now downloaded from the gnu mirror in the hope that it works better --- ports/install.sh | 23 ++++++++++++++++++----- ports/ncurses/build.sh | 2 +- ports/update.sh | 4 ++-- ports/vim/build.sh | 2 +- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/ports/install.sh b/ports/install.sh index 8a1e0242..abb49707 100755 --- a/ports/install.sh +++ b/ports/install.sh @@ -5,10 +5,19 @@ if (( $# != 1 )); then exit 1 fi -BANAN_ROOT_DIR="$(dirname $(realpath $0))/.." +if [[ -z $BANAN_ROOT_DIR ]]; then + BANAN_ROOT_DIR="$(dirname $(realpath $0))/.." +fi + source "$BANAN_ROOT_DIR/script/config.sh" + export PATH="$BANAN_TOOLCHAIN_PREFIX/bin:$PATH" +export PKG_CONFIG='pkg-config --static' +export PKG_CONFIG_SYSROOT_DIR="$BANAN_SYSROOT" +export PKG_CONFIG_LIBDIR="$PKG_CONFIG_SYSROOT_DIR/usr/lib/pkgconfig" +export PKG_CONFIG_PATH="$PKG_CONFIG_SYSROOT_DIR/usr/share/pkgconfig" + if [ ! -f "$BANAN_SYSROOT/usr/lib/libc.a" ]; then pushd "$BANAN_ROOT_DIR" >/dev/null ./bos libc || exit 1 @@ -21,7 +30,7 @@ clean() { } build() { - configure_options=("--host=$BANAN_ARCH-banan_os" "--prefix=/usr" ) + configure_options=("--host=$BANAN_ARCH-banan_os" '--prefix=/usr') configure_options+=(${CONFIGURE_OPTIONS[*]}) ./configure ${configure_options[*]} || exit 1 @@ -51,6 +60,10 @@ done build_dir="$NAME-$VERSION-$BANAN_ARCH" +if [ ! -d "$build_dir" ]; then + rm -f ".compile_hash-$BANAN_ARCH" +fi + if [ "$VERSION" = "git" ]; then regex="(.*/.*\.git)#(.*)" @@ -71,7 +84,7 @@ if [ "$VERSION" = "git" ]; then pushd "$build_dir" >/dev/null git checkout "$COMMIT" || exit 1 - if [ -d patches ]; then + if [ -d ../patches ]; then for patch in ../patches/*; do git apply "$patch" || exit 1 done @@ -111,7 +124,7 @@ else if [ -d patches ]; then for patch in ./patches/*; do - patch -ruN -d "$build_dir" < "$patch" || exit 1 + patch -ruN -p1 -d "$build_dir" < "$patch" || exit 1 done fi fi @@ -123,7 +136,7 @@ fi needs_compile=1 if [ -f ".compile_hash-$BANAN_ARCH" ]; then - cat ".compile_hash-$BANAN_ARCH" | sha256sum --check >/dev/null + sha256sum --check ".compile_hash-$BANAN_ARCH" &>/dev/null needs_compile=$? fi diff --git a/ports/ncurses/build.sh b/ports/ncurses/build.sh index 0a59148b..7763ee65 100755 --- a/ports/ncurses/build.sh +++ b/ports/ncurses/build.sh @@ -2,7 +2,7 @@ NAME='ncurses' VERSION='6.5' -DOWNLOAD_URL="https://invisible-island.net/archives/ncurses/ncurses-$VERSION.tar.gz#136d91bc269a9a5785e5f9e980bc76ab57428f604ce3e5a5a90cebc767971cc6" +DOWNLOAD_URL="https://ftp.gnu.org/gnu/ncurses/ncurses-$VERSION.tar.gz#136d91bc269a9a5785e5f9e980bc76ab57428f604ce3e5a5a90cebc767971cc6" CONFIGURE_OPTIONS=( '--disable-db-intall' '--disable-widec' diff --git a/ports/update.sh b/ports/update.sh index ac806b6d..49396872 100755 --- a/ports/update.sh +++ b/ports/update.sh @@ -2,8 +2,8 @@ cd $(dirname $(realpath $0)) -for port in ./*/.compile_hash*; do +while IFS= read -r port; do pushd $(dirname "$port") >/dev/null ./build.sh popd >/dev/null -done +done < <(find . -name '.compile_hash*') diff --git a/ports/vim/build.sh b/ports/vim/build.sh index 9ef1d85e..3a29a29a 100755 --- a/ports/vim/build.sh +++ b/ports/vim/build.sh @@ -4,7 +4,7 @@ NAME='vim' VERSION='9.0' DOWNLOAD_URL="ftp://ftp.vim.org/pub/vim/unix/vim-$VERSION.tar.bz2#a6456bc154999d83d0c20d968ac7ba6e7df0d02f3cb6427fb248660bacfb336e" TAR_CONTENT='vim90' -DEPENDENCIES=( 'ncurses' ) +DEPENDENCIES=('ncurses' ) CONFIGURE_OPTIONS=( '--with-tlib=ncurses' '--disable-nls'