# Example of a satellite file, which is just a shell script with a cool name.
import 'say_hello' # Import some functions. See functions/say_hello.sh for more info.
# Info (Please declare it, as it will be used outside of this script, too)
# Required info
name=hello # Name of the software, not the package name.
# Same source files will be used for the same software, despite the package name being different.
version=2.10
# Optional info
update_url="https://ftp.gnu.org/gnu/$name/" # URL to a downloadable plain-text file which updates when a new version is available.
update_names="$name-$version.tar.gz" # Specify what the lines containing the version number look like on the download page.
# It's a comma-separated list, and can contain multiple entries.
# Every entry must contain at least one instance of $version,
# as another program will look for any different versions on the same page.
# You may not need to set this, in which case the program will try to guess it from the download commands.
vcs_compile=true # Set this to true if it's a vcs package, and we've just downloaded an update for it. This is meant to be used in functions, and has to be set before header_end is called.
# Define options used in this satellite.
define_option '!check: Enable the testsuite.' # Due to the '!' at the start, check is false by default.
define_option 'test=Default value' # It is also allowed to provide no description
# You should define every option used in your satellite.
# See lower for info on how to use these options.
# Please note that setting the above info in an imported script is supported, as long as it's done in the header.
# Astronaut will generally prefix internal variables with "_". There are, however, a few exceptions.
# Some of those you can touch, some not.
# "You shouldn't even look, unless you're hacking really bad, but definitely don't touch"-variables:
# - dir_build (You cd into it automatically. Just use relative paths or $PWD.)
# - dir_source (This is handled by the commands detailed below. You should have no use for it.)
# "Look, but don't touch"-variables:
# - All other dir_* variables
# "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, ignoring default/user config.)
# - cmd_download
# - cmd_extract
# - vcs_compile
# - download_only
# - options
# Get them files.
# URL [REQUIRED], MD5sum, Custom filename, Custom command
download "https://ftp.gnu.org/gnu/$name/$name-$version.tar.gz" \
'6cd0ffea3884a4e79330338dcc2987d6' \
"$name-$version.tar.gz" \
'curl -L -o {dst} {src}'
# Abbreviation download and extract. Does not allow custom commands.
#dlextract "https://ftp.gnu.org/gnu/$name/$name-$version.tar.gz" \
# '6cd0ffea3884a4e79330338dcc2987d6'
# Abbreviation for downloading a file and copying it over.
#dlfile 'http://example.com/Waffles.txt' \
# 'MD5SUM'
# Copy local file to build directory. File should be stored in $(basedir <satellite file>)/extrafiles/$name/
#extrafile 'Herpaderp.txt'
header_end # End of the header.
# The only commands that are allowed to be in the header are:
# - download
# - dlextract
# - dlfile
# - extrafile
# - import
# - define_option
# getfile and extract are technically allowed, but not encouraged.
# Basically, do not use anything that touches dir_build or dir_install or does anything other than fetching the required files.
# The same rule above applies for imported commands.
# Name [REQUIRED], Destination, Custom command
extract "$name-$version.tar.gz" \
'.' \
'tar xvfC {src} {dst}'
# Copy some file you downloaded over to the build directory.
#getfile "Waffles.txt"
# Compilation instructions
cd "$name-$version"
./configure --prefix="/$dir_prefix"
make
# Know if the user wants the package to be checked
# Check if an option is disabled
if option check; then
make check
fi
# Abbreviation of the above
#option check make check
# Bangs ("!") negate the operation.
#option !check echo "The package wasn't checked"
make DESTDIR="$dir_install" install
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
# Options with values.
echo "Value of option test = $(option =test)"
# Misc functions:
#safe_sed 'oh/i/hope\i\canuse%&thisinsed'
# Escapes all the necessary characters to be able to use an arbitrary string in a regular sed command
# vim:set tabstop=4 shiftwidth=4 syntax=sh expandtab: