From e3f777af180ba56a636737a07a0ca79924f2b6dd Mon Sep 17 00:00:00 2001 From: mid-kid Date: Wed, 1 Jun 2016 22:37:55 +0200 Subject: [PATCH] Add dir_preprefix Reverted the separator for dir_* variables change, due to it's stupidity --- astronaut/astronaut | 24 ++++++++++++------- astronaut/astronaut.sat | 12 +++++----- astronaut/hello.sat | 11 +++------ astronaut/template.sat | 2 +- satellites/3dsfat16tool.sat | 2 +- satellites/astronaut.sat | 20 +++++++++++++++- satellites/bin/devkitarm.sat | 8 +++---- .../bin/extrafiles/devkitarm/devkitarm.sh | 2 +- satellites/bin/palemoon.sat | 24 +++++++++---------- satellites/bin/unetbootin.sat | 2 +- satellites/ctrtool.sat | 2 +- satellites/libconfig.sat | 2 +- satellites/lua.sat | 2 +- satellites/makerom.sat | 2 +- satellites/markdown.sat | 2 +- satellites/padxorer.sat | 2 +- satellites/vcs/bannertool.sat | 4 ++-- satellites/vcs/ctrtool-git.sat | 2 +- satellites/vcs/makerom-git.sat | 2 +- satellites/webfs.sat | 2 +- 20 files changed, 75 insertions(+), 54 deletions(-) mode change 120000 => 100644 satellites/astronaut.sat diff --git a/astronaut/astronaut b/astronaut/astronaut index 75a4c28..c983b3d 100755 --- a/astronaut/astronaut +++ b/astronaut/astronaut @@ -4,8 +4,9 @@ dir_build="/tmp/astronaut/build" # Temporary directory to build packages dir_source="/tmp/astronaut/source" # Directory where the package sources will be placed dir_install="/tmp/astronaut/install" # Directory where the package will be installed -dir_sysroot="" # The root dir (The directory programs will look in and symlinks will point to) -dir_prefix="/usr" # Prefix directory +dir_sysroot="" # The directory to look for libraries for the target system +dir_preprefix="/" # Upper prefix directory (for /etc, /opt and such. Don't ask me why people decided to put them in a different dir. It's pretty retarded.) +dir_prefix="/usr" # Prefix directory (for /bin, /lib, /share and such) cmd_download="curl -# -L -o {dst} {src}" # Command to execute to download files cmd_extract="tar -x -C {dst} -f {src}" # Command to execute to extract files unset dir_satellites # Directory where the satellite files are placed. @@ -29,9 +30,10 @@ Usage: $0 [-sbipr ] [-Id] [-o ] -b Set build directory [WARNING: Will be deleted before build] -s Set source directory -i Set install directory --p Set prefix directory -r Set root directory --I Nuke install directory before build +-e Set pre-prefix directory +-p Set prefix directory +-I Nuke install directory before build [WARNING: You will not be prompted] -d Only download package files -v Only build vcs package if any updates have been made to it -o Set package options (comma-separated)" @@ -47,7 +49,7 @@ _exiterr() { } # Gather info -while getopts "h?s:b:i:p:r:IcCdvo:" opt; do +while getopts "h?s:b:i:r:e:p:IcCdvo:" opt; do case "$opt" in h|\?) _show_help @@ -62,12 +64,15 @@ while getopts "h?s:b:i:p:r:IcCdvo:" opt; do i) dir_install="$OPTARG" ;; - p) - dir_prefix="$OPTARG" - ;; r) dir_sysroot="$OPTARG" ;; + e) + dir_preprefix="$OPTARG" + ;; + p) + dir_prefix="$OPTARG" + ;; I) _nuke_dir_install=true ;; @@ -91,6 +96,9 @@ if [ ! "$1" ]; then exit 1 fi +# Modify some variables +dir_prefix="$dir_preprefix/$dir_prefix" + # Tools for the astronaut _mksum() { echo "$(md5sum "$@" 2> /dev/null | cut -d' ' -f1)" diff --git a/astronaut/astronaut.sat b/astronaut/astronaut.sat index 12d00cd..1d81a10 100644 --- a/astronaut/astronaut.sat +++ b/astronaut/astronaut.sat @@ -9,11 +9,11 @@ extrafile "pacman-astronaut" extrafile "astronautpkg" header_end -install -D "astronaut" "$dir_install$dir_prefix/bin/astronaut" -install -D "astrohelp" "$dir_install$dir_prefix/bin/astrohelp" -install -D "freshnaut" "$dir_install$dir_prefix/bin/freshnaut" -install -D "xbps-astronaut" "$dir_install$dir_prefix/bin/xbps-astronaut" -install -D "pacman-astronaut" "$dir_install$dir_prefix/bin/pacman-astronaut" -install -D "astronautpkg" "$dir_install$dir_prefix/bin/astronautpkg" +install -D "astronaut" "$dir_install/$dir_prefix/bin/astronaut" +install -D "astrohelp" "$dir_install/$dir_prefix/bin/astrohelp" +install -D "freshnaut" "$dir_install/$dir_prefix/bin/freshnaut" +install -D "xbps-astronaut" "$dir_install/$dir_prefix/bin/xbps-astronaut" +install -D "pacman-astronaut" "$dir_install/$dir_prefix/bin/pacman-astronaut" +install -D "astronautpkg" "$dir_install/$dir_prefix/bin/astronautpkg" # vim:set tabstop=4 shiftwidth=4 syntax=sh et: diff --git a/astronaut/hello.sat b/astronaut/hello.sat index abc72ea..57298f7 100644 --- a/astronaut/hello.sat +++ b/astronaut/hello.sat @@ -27,8 +27,9 @@ vcs_compile=true # Set this to true if it's a vcs package, and we've just downl # - dir_source (This is handled by the commands detailed below. You should have no use for it.) # "Look, but don't touch"-variables: # - dir_install -# - dir_prefix # - dir_sysroot +# - dir_preprefix +# - dir_prefix # "You'll only make your own life more difficult if you use them wrong, so I don't care what you do"-variables: # (Only use these to change the behaviour of some commands over the whole script.) # - cmd_download @@ -36,12 +37,6 @@ vcs_compile=true # Set this to true if it's a vcs package, and we've just downl # - vcs_compile # - options -# General info about the usage of these variables: -# - When chaining any of the dir_* variables, do not separate them by a '/'. -# - There's actually just very 2 possible valid chaining combinations for these: Either $dir_sysroot$dir_prefix, -# or $dir_install$dir_prefix -# - Also do not add a '/' at the beginning if you're starting with a dir_* variable. - # Get them files. # URL [REQUIRED], MD5sum, Custom command download "https://ftp.gnu.org/gnu/$name/$name-$version.tar.gz" \ @@ -93,7 +88,7 @@ option test echo "Test option enabled" # Bangs ("!") negate the operation. make DESTDIR="$dir_install" install -rm "$dir_install$dir_prefix/share/info/dir" # This file collides with some other packages. +rm "$dir_install/$dir_prefix/share/info/dir" # This file collides with some other packages. # Call the function we imported. For more info see the top of the file, and functions/say_hello.sh say_hello diff --git a/astronaut/template.sat b/astronaut/template.sat index 496e370..996797a 100644 --- a/astronaut/template.sat +++ b/astronaut/template.sat @@ -14,6 +14,6 @@ cd "$name-$version" make option !no_check make check make DESTDIR="$dir_install" install -rm "$dir_install$dir_prefix/share/info/dir" # This file collides with some other packages. +rm "$dir_install/$dir_prefix/share/info/dir" # This file collides with some other packages. # vim:set tabstop=4 shiftwidth=4 syntax=sh et: diff --git a/satellites/3dsfat16tool.sat b/satellites/3dsfat16tool.sat index c15db38..504a752 100644 --- a/satellites/3dsfat16tool.sat +++ b/satellites/3dsfat16tool.sat @@ -8,6 +8,6 @@ header_end cd "$name-$version" cc -O3 "$name.c" -o "$name" -install -Dm755 "$name" "$dir_install$dir_prefix/bin/$name" +install -Dm755 "$name" "$dir_install/$dir_prefix/bin/$name" # vim:set tabstop=4 shiftwidth=4 syntax=sh et: diff --git a/satellites/astronaut.sat b/satellites/astronaut.sat deleted file mode 120000 index df636ec..0000000 --- a/satellites/astronaut.sat +++ /dev/null @@ -1 +0,0 @@ -../astronaut/astronaut.sat \ No newline at end of file diff --git a/satellites/astronaut.sat b/satellites/astronaut.sat new file mode 100644 index 0000000..1d81a10 --- /dev/null +++ b/satellites/astronaut.sat @@ -0,0 +1,19 @@ +name=astronaut +version=$(date +%Y%m%d) + +extrafile "astronaut" +extrafile "astrohelp" +extrafile "freshnaut" +extrafile "xbps-astronaut" +extrafile "pacman-astronaut" +extrafile "astronautpkg" +header_end + +install -D "astronaut" "$dir_install/$dir_prefix/bin/astronaut" +install -D "astrohelp" "$dir_install/$dir_prefix/bin/astrohelp" +install -D "freshnaut" "$dir_install/$dir_prefix/bin/freshnaut" +install -D "xbps-astronaut" "$dir_install/$dir_prefix/bin/xbps-astronaut" +install -D "pacman-astronaut" "$dir_install/$dir_prefix/bin/pacman-astronaut" +install -D "astronautpkg" "$dir_install/$dir_prefix/bin/astronautpkg" + +# vim:set tabstop=4 shiftwidth=4 syntax=sh et: diff --git a/satellites/bin/devkitarm.sat b/satellites/bin/devkitarm.sat index dca108b..34780a7 100644 --- a/satellites/bin/devkitarm.sat +++ b/satellites/bin/devkitarm.sat @@ -8,9 +8,9 @@ download "https://sourceforge.net/projects/devkitpro/files/$name/${name}_$versio extrafile "devkitarm.sh" header_end -mkdir -p "$dir_install/opt/devkitPRO" -extract "${name}_$version-x86_64-linux.tar.bz2" "$dir_install/opt/devkitPRO" -sed -i -e "s@%SYSROOT%@$dir_sysroot@g" devkitarm.sh -install -Dm644 devkitarm.sh "$dir_install/etc/profile.d/devkitarm.sh" +mkdir -p "$dir_install/$dir_preprefix/opt/devkitPRO" +extract "${name}_$version-x86_64-linux.tar.bz2" "$dir_install/$dir_preprefix/opt/devkitPRO" +sed -i -e "s@%PREFIX%@$dir_preprefix@g" devkitarm.sh +install -Dm644 devkitarm.sh "$dir_install/$dir_preprefix/etc/profile.d/devkitarm.sh" # vim:set tabstop=4 shiftwidth=4 syntax=sh et: diff --git a/satellites/bin/extrafiles/devkitarm/devkitarm.sh b/satellites/bin/extrafiles/devkitarm/devkitarm.sh index 6443e16..a046dda 100644 --- a/satellites/bin/extrafiles/devkitarm/devkitarm.sh +++ b/satellites/bin/extrafiles/devkitarm/devkitarm.sh @@ -1,3 +1,3 @@ -export DEVKITPRO="%SYSROOT%/opt/devkitPRO" +export DEVKITPRO="%PREFIX%/opt/devkitPRO" export DEVKITARM="$DEVKITPRO/devkitARM" export PATH="$DEVKITARM/bin:$PATH" diff --git a/satellites/bin/palemoon.sat b/satellites/bin/palemoon.sat index d589622..f2ed906 100644 --- a/satellites/bin/palemoon.sat +++ b/satellites/bin/palemoon.sat @@ -7,18 +7,18 @@ download "http://linux.palemoon.org/files/$version/$name-$version.en-US.linux-x8 extrafile "palemoon.desktop" header_end -mkdir -p "$dir_install/opt" "$dir_install$dir_prefix/bin" "$dir_install$dir_prefix/share/applications" \ - "$dir_install$dir_prefix/share/icons/hicolor/16x16/apps" \ - "$dir_install$dir_prefix/share/icons/hicolor/32x32/apps" \ - "$dir_install$dir_prefix/share/icons/hicolor/48x48/apps" \ - "$dir_install$dir_prefix/share/icons/hicolor/128x128/apps" \ +mkdir -p "$dir_install/$dir_preprefix/opt" "$dir_install/$dir_prefix/bin" "$dir_install/$dir_prefix/share/applications" \ + "$dir_install/$dir_prefix/share/icons/hicolor/16x16/apps" \ + "$dir_install/$dir_prefix/share/icons/hicolor/32x32/apps" \ + "$dir_install/$dir_prefix/share/icons/hicolor/48x48/apps" \ + "$dir_install/$dir_prefix/share/icons/hicolor/128x128/apps" \ -extract "$name-$version.en-US.linux-x86_64.tar.bz2" "$dir_install/opt" -ln -s "$dir_sysroot/opt/$name/$name" "$dir_install$dir_prefix/bin/$name" -ln -s "$dir_sysroot/opt/$name/browser/chrome/icons/default/default16.png" "$dir_install$dir_prefix/share/icons/hicolor/16x16/apps/$name.png" -ln -s "$dir_sysroot/opt/$name/browser/chrome/icons/default/default32.png" "$dir_install$dir_prefix/share/icons/hicolor/32x32/apps/$name.png" -ln -s "$dir_sysroot/opt/$name/browser/chrome/icons/default/default48.png" "$dir_install$dir_prefix/share/icons/hicolor/48x48/apps/$name.png" -ln -s "$dir_sysroot/opt/$name/browser/icons/mozicon128.png" "$dir_install$dir_prefix/share/icons/hicolor/128x128/apps/$name.png" -cp "palemoon.desktop" "$dir_install$dir_prefix/share/applications/palemoon.desktop" +extract "$name-$version.en-US.linux-x86_64.tar.bz2" "$dir_install/$dir_preprefix/opt" +ln -s "$dir_preprefix/opt/$name/$name" "$dir_install/$dir_prefix/bin/$name" +ln -s "$dir_preprefix/opt/$name/browser/chrome/icons/default/default16.png" "$dir_install/$dir_prefix/share/icons/hicolor/16x16/apps/$name.png" +ln -s "$dir_preprefix/opt/$name/browser/chrome/icons/default/default32.png" "$dir_install/$dir_prefix/share/icons/hicolor/32x32/apps/$name.png" +ln -s "$dir_preprefix/opt/$name/browser/chrome/icons/default/default48.png" "$dir_install/$dir_prefix/share/icons/hicolor/48x48/apps/$name.png" +ln -s "$dir_preprefix/opt/$name/browser/icons/mozicon128.png" "$dir_install/$dir_prefix/share/icons/hicolor/128x128/apps/$name.png" +cp "palemoon.desktop" "$dir_install/$dir_prefix/share/applications/palemoon.desktop" # vim:set tabstop=4 shiftwidth=4 syntax=sh et: diff --git a/satellites/bin/unetbootin.sat b/satellites/bin/unetbootin.sat index 8ec4f11..f633486 100644 --- a/satellites/bin/unetbootin.sat +++ b/satellites/bin/unetbootin.sat @@ -6,6 +6,6 @@ dlfile "https://launchpad.net/$name/trunk/$version/+download/$name-linux64-$vers "d5d1cddc144fc64d8291c33ebd4f457b" header_end -install -D $name-linux64-$version.bin "$dir_install$dir_prefix/bin/$name" +install -D $name-linux64-$version.bin "$dir_install/$dir_prefix/bin/$name" # vim:set tabstop=4 shiftwidth=4 syntax=sh et: diff --git a/satellites/ctrtool.sat b/satellites/ctrtool.sat index 534f277..d2881c5 100644 --- a/satellites/ctrtool.sat +++ b/satellites/ctrtool.sat @@ -9,6 +9,6 @@ header_end cd "$name-$version/ctrtool" make -install -D ctrtool "$dir_install$dir_prefix/bin/ctrtool" +install -D ctrtool "$dir_install/$dir_prefix/bin/ctrtool" # vim:set tabstop=4 shiftwidth=4 syntax=sh et: diff --git a/satellites/libconfig.sat b/satellites/libconfig.sat index 5dc0fd4..0eaf210 100644 --- a/satellites/libconfig.sat +++ b/satellites/libconfig.sat @@ -10,6 +10,6 @@ header_end cd "$name-$version" compile_configure -rm "$dir_install$dir_prefix/share/info/dir" +rm "$dir_install/$dir_prefix/share/info/dir" # vim:set tabstop=4 shiftwidth=4 syntax=sh et: diff --git a/satellites/lua.sat b/satellites/lua.sat index 4809af2..2e00afa 100644 --- a/satellites/lua.sat +++ b/satellites/lua.sat @@ -9,6 +9,6 @@ header_end cd "$name-$version" make MYLIBS="-lncurses" MYCFLAGS="$CFLAGS" linux option !no_check make test -make INSTALL_TOP="$dir_install$dir_prefix" install +make INSTALL_TOP="$dir_install/$dir_prefix" install # vim:set tabstop=4 shiftwidth=4 syntax=sh et: diff --git a/satellites/makerom.sat b/satellites/makerom.sat index 4b69390..b0bc194 100644 --- a/satellites/makerom.sat +++ b/satellites/makerom.sat @@ -9,6 +9,6 @@ header_end cd "$name-$version/makerom" make -install -D makerom "$dir_install$dir_prefix/bin/makerom" +install -D makerom "$dir_install/$dir_prefix/bin/makerom" # vim:set tabstop=4 shiftwidth=4 syntax=sh et: diff --git a/satellites/markdown.sat b/satellites/markdown.sat index 2c3d81c..a25042b 100644 --- a/satellites/markdown.sat +++ b/satellites/markdown.sat @@ -9,6 +9,6 @@ header_end # TODO: Support other formats, such as zip, with the extract command. extract "${name}_$version.zip" "" \ "unzip -qd {dst} {src}" -install -D "${name}_$version/$name.pl" "$dir_install$dir_prefix/bin/markdown" +install -D "${name}_$version/$name.pl" "$dir_install/$dir_prefix/bin/markdown" # vim:set tabstop=4 shiftwidth=4 syntax=sh et: diff --git a/satellites/padxorer.sat b/satellites/padxorer.sat index 22d6317..61c0d44 100644 --- a/satellites/padxorer.sat +++ b/satellites/padxorer.sat @@ -7,6 +7,6 @@ dlfile "http://pastebin.com/raw/$paste" \ header_end cc -x c -O3 "$paste" -o "$name" -install -Dm755 "$name" "$dir_install$dir_prefix/bin/$name" +install -Dm755 "$name" "$dir_install/$dir_prefix/bin/$name" # vim:set tabstop=4 shiftwidth=4 syntax=sh et: diff --git a/satellites/vcs/bannertool.sat b/satellites/vcs/bannertool.sat index 7d1337c..f184135 100644 --- a/satellites/vcs/bannertool.sat +++ b/satellites/vcs/bannertool.sat @@ -8,8 +8,8 @@ header_end cd "$name" # Fix retarded build system -sed -i -e "s@/usr/local@'$dir_install$dir_prefix'@g" buildtools/make_base -mkdir -p "$dir_install$dir_prefix/bin" +sed -i -e "s@/usr/local@'$dir_install/$dir_prefix'@g" buildtools/make_base +mkdir -p "$dir_install/$dir_prefix/bin" make make install diff --git a/satellites/vcs/ctrtool-git.sat b/satellites/vcs/ctrtool-git.sat index 5671332..e2678bb 100644 --- a/satellites/vcs/ctrtool-git.sat +++ b/satellites/vcs/ctrtool-git.sat @@ -7,6 +7,6 @@ header_end cd "$name/ctrtool" make -install -D ctrtool "$dir_install$dir_prefix/bin/ctrtool" +install -D ctrtool "$dir_install/$dir_prefix/bin/ctrtool" # vim:set tabstop=4 shiftwidth=4 syntax=sh et: diff --git a/satellites/vcs/makerom-git.sat b/satellites/vcs/makerom-git.sat index 80cbdac..e4eb3db 100644 --- a/satellites/vcs/makerom-git.sat +++ b/satellites/vcs/makerom-git.sat @@ -7,6 +7,6 @@ header_end cd "$name/makerom" make -install -D makerom "$dir_install$dir_prefix/bin/makerom" +install -D makerom "$dir_install/$dir_prefix/bin/makerom" # vim:set tabstop=4 shiftwidth=4 syntax=sh et: diff --git a/satellites/webfs.sat b/satellites/webfs.sat index 03d5506..3e3a853 100644 --- a/satellites/webfs.sat +++ b/satellites/webfs.sat @@ -14,6 +14,6 @@ sed -i -e "s/echo -e/echo/g" mk/Autoconf.mk sed -i -e "s@/etc/mime.types@/dev/null@g" GNUmakefile make -install -D "${name}d" "$dir_install$dir_prefix/bin/${name}d" +install -D "${name}d" "$dir_install/$dir_prefix/bin/${name}d" # vim:set tabstop=4 shiftwidth=4 syntax=sh et: