fixup! Add ports to the Sortix repository.

This commit is contained in:
Jonas 'Sortie' Termansen 2022-01-29 22:47:20 +01:00
parent c89a412288
commit 480f58d000
3 changed files with 166 additions and 3 deletions

View File

@ -1,4 +1,5 @@
#!/bin/sh -e
#!/bin/sh
set -e
make_dir_path_absolute() {
(cd "$1" && pwd)

155
build-aux/upgrade-port.sh Executable file
View File

@ -0,0 +1,155 @@
#!/bin/sh
set -e
. "$1"
if [ -z "$UPSTREAM_ARCHIVE" ]; then exit; fi
NAME_REGEXP="$(echo "$NAME" | sed -E 's,\+,\\+,g')"
case "$NAME" in
ag)
UPSTREAM_VERSION_PAGE="https://geoff.greer.fm/ag/"
;;
bochs)
UPSTREAM_VERSION_PAGE="https://sourceforge.net/projects/bochs/files/bochs/"
SEARCH_REGEX="([0-9]+\.[0-9]+(\.[0-9]+)*)/"
UPSTREAM_SITE_TEMPLATE="https://sourceforge.net/projects/bochs/files/bochs/%v"
;;
e2fsprogs)
UPSTREAM_VERSION_PAGE="https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/"
SEARCH_REGEX="v([0-9]+\.[0-9]+(\.[0-9]+)*)/"
UPSTREAM_SITE_TEMPLATE="https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v%v"
;;
binutils|gcc|grub|libstdc++)
VERSION_REGEX="sortix-$NAME_REGEXP-([0-9]+\.[0-9]+(\.[0-9]+)*)(-rc[0-9]+)";;
libcurses)
UPSTREAM_SITE="https://ftp.barfooze.de/pub/sabotage/tarballs"
;;
libevent)
VERSION_REGEX="libevent-([0-9]+\\.[0-9]+(\\.[0-9]+)*-stable)"
UPSTREAM_SITE_TEMPLATE="https://github.com/libevent/libevent/releases/download/release-%v"
UPSTREAM_ARCHIVE_TEMPLATE="libevent-%v.tar.gz"
;;
libexpat)
UPSTREAM_SITE_TEMPLATE="https://github.com/libexpat/libexpat/releases/download/R_%M_%m_%p"
;;
libjpeg)
UPSTREAM_SITE="https://www.ijg.org/files"
VERSION_REGEX="jpegsrc.v([0-9]+[a-z])"
;;
libgmp)
VERSION_REGEX=$(echo "$UPSTREAM_ARCHIVE" |
sed -E 's,([0-9]+\.[0-9]+(\.[0-9]+)*a?)(\.tar.*),([0-9]+\\.[0-9]+(\\.[0-9]+)*a?),')
;;
libpcre)
UPSTREAM_VERSION_PAGE="https://sourceforge.net/projects/pcre/files/pcre/"
SEARCH_REGEX="([0-9]+\.[0-9]+(\.[0-9]+)*)/"
UPSTREAM_SITE_TEMPLATE="https://sourceforge.net/projects/pcre/files/pcre/%v"
;;
libpng)
UPSTREAM_VERSION_PAGE="http://libpng.org/pub/png/libpng.html"
# TODO: Switch to this upstream site since it also works for older versions.
UPSTREAM_SITE="https://download.sourceforge.net/libpng"
;;
nasm)
UPSTREAM_VERSION_PAGE="https://www.nasm.us/pub/nasm/releasebuilds/"
SEARCH_REGEX="([0-9]+\.[0-9]+(\.[0-9]+)*)/"
UPSTREAM_SITE_TEMPLATE="https://www.nasm.us/pub/nasm/releasebuilds/%v"
;;
nyancat)
UPSTREAM_VERSION_PAGE="https://github.com/klange/nyancat/tags"
;;
python)
UPSTREAM_VERSION_PAGE="https://www.python.org/downloads/source/"
SEARCH_REGEX="Python-([0-9]+\.[0-9]+(\.[0-9]+)*)(\.tar(\.(gz|bz2|xz)))"
UPSTREAM_SITE_TEMPLATE="https://www.python.org/ftp/python/%v"
;;
esac
TAR_REGEX="(\.tar(\.(gz|bz2|xz)))"
if [ -z "$UPSTREAM_VERSION_PAGE" ]; then
case "$UPSTREAM_SITE" in
https://github.com/*/releases/*)
UPSTREAM_VERSION_PAGE=$(echo "$UPSTREAM_SITE" | grep -Eo '.*/releases/');;
*) UPSTREAM_VERSION_PAGE="$UPSTREAM_SITE/";;
esac
fi
if [ -z "$VERSION_REGEX" ]; then
VERSION_REGEX=$(echo "$UPSTREAM_ARCHIVE" |
sed -E 's,([0-9]+\.[0-9]+(\.[0-9]+)*)(\.tar.*),([0-9]+\\.[0-9]+(\\.[0-9]+)*),')
fi
if [ -z "$VERSION" ]; then
VERSION=$(echo "$UPSTREAM_ARCHIVE" | sed -E "s,$VERSION_REGEX,\1")
fi
if [ -z "$UPSTREAM_SITE_TEMPLATE" ]; then
UPSTREAM_SITE_TEMPLATE="$UPSTREAM_SITE"
fi
if [ -z "$UPSTREAM_ARCHIVE_TEMPLATE" ]; then
UPSTREAM_ARCHIVE_TEMPLATE=$(echo "$UPSTREAM_ARCHIVE" |
sed -E 's,([0-9]+\.[0-9]+(\.[0-9]+)*)(\.tar.*),%v%e,')
fi
if [ -z "$SEARCH_REGEX" ]; then
SEARCH_REGEX="\<$VERSION_REGEX$TAR_REGEX\>"
fi
case "$UPSTREAM_ARCHIVE" in
*.tar) EXTENSION=.tar;;
*.tar.gz) EXTENSION=.tar.gz;;
*.tar.bz2) EXTENSION=.tar.bz2;;
*.tar.xz) EXTENSION=.tar.xz;;
esac
instantiate() {
echo "$1" |
sed -E \
-e "s,%v,$2,g" \
-e "s,%M,$(echo "$2" | sed -E 's,([0-9]+)\.([0-9]+)(\.([0-9]+))?.*,\1,'),g" \
-e "s,%m,$(echo "$2" | sed -E 's,([0-9]+)\.([0-9]+)(\.([0-9]+))?.*,\2,'),g" \
-e "s,%p,$(echo "$2" | sed -E 's,([0-9]+)\.([0-9]+)(\.([0-9]+))?.*,\4,'),g" \
-e "s,%e,$EXTENSION,g"
}
# git tag search
LATEST=$(curl -Ls "$UPSTREAM_VERSION_PAGE" | grep -Eo "$SEARCH_REGEX" | sort -Vu | tail -1)
case "$LATEST" in
*.tar) EXTENSION=.tar;;
*.tar.gz) EXTENSION=.tar.gz;;
*.tar.bz2) EXTENSION=.tar.bz2;;
*.tar.xz) EXTENSION=.tar.xz;;
esac
NEW_VERSION="$(echo "$LATEST" | sed -E "s,$SEARCH_REGEX,\1,")"
if [ -z "$NEW_VERSION" ]; then
echo "\e[91m$UPSTREAM_ARCHIVE failed to find available versions: $NEW_VERSION_REGEX on $UPSTREAM_VERSION_PAGE\e[m"
exit 1
fi
NEW_UPSTREAM_SITE=$(instantiate "$UPSTREAM_SITE_TEMPLATE" "$NEW_VERSION")
NEW_UPSTREAM_ARCHIVE=$(instantiate "$UPSTREAM_ARCHIVE_TEMPLATE" "$NEW_VERSION")
if ! wget -q "$NEW_UPSTREAM_SITE/$NEW_UPSTREAM_ARCHIVE" -O /dev/null; then
echo "\e[91m$NAME failed to download: $NEW_UPSTREAM_SITE/$NEW_UPSTREAM_ARCHIVE\e[m"
exit 1
fi
if [ "$VERSION" != "$NEW_VERSION" ]; then
echo "\e[1;92m$NAME $VERSION -> $NEW_VERSION $NEW_UPSTREAM_SITE/$NEW_UPSTREAM_ARCHIVE\e[m"
else
# Confirmed to actually be up to date.
case "$NAME" in
flex|gcc|grub|texinfo|libiconv|libtheora|libSDL|libz|nyancat|pkg-config)
echo "\e[92m$NAME $VERSION is up to date\e[m"
;;
*)
echo "$NAME $VERSION is up to date"
;;
esac
fi

View File

@ -66,17 +66,24 @@ for port in $ports; do
echo "rm -rf -- 'docs/stamp-1'" >> "patch.normalize"
echo "rm -rf -- 'docs/stamp-vti'" >> "patch.normalize"
;;
libidn|texinfo)
libidn)
# TODO: Which of these were actually a problem?
echo "rm -rf -- 'doc/Makefile.gdoc'" >> "patch.normalize"
echo "rm -rf -- 'doc/stamp-vti'" >> "patch.normalize"
;;
texinfo)
echo "rm -rf -- 'doc/Makefile.gdoc'" >> "patch.normalize"
echo "rm -rf -- 'doc/stamp-1'" >> "patch.normalize"
echo "rm -rf -- 'doc/stamp-vti'" >> "patch.normalize"
;;
libglib)
echo "rm -rf -- 'tests/gobject/testmarshal.h'" >> "patch.normalize"
echo "rm -rf -- 'tests/gobject/testmarshal.c'" >> "patch.normalize"
;;
python)
echo "rm -rf -- 'Python/graminit.c'" >> "patch.normalize"
echo "rm -rf -- 'Include/graminit.h'" >> "patch.normalize"
# TODO: This file has to exist and be writeable. Sigh.
#echo "rm -rf -- 'Include/graminit.h'" >> "patch.normalize"
echo "rm -rf -- 'Python/importlib_external.h'" >> "patch.normalize"
echo "rm -rf -- 'Python/importlib.h'" >> "patch.normalize"
;;