Added sample build files
This commit is contained in:
parent
34502b73e5
commit
5050084a66
3 changed files with 210 additions and 0 deletions
14
buildsamples/doinst.sh.sample
Normal file
14
buildsamples/doinst.sh.sample
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
config() {
|
||||||
|
NEW="$1"
|
||||||
|
OLD="$(dirname $NEW)/$(basename $NEW .new)"
|
||||||
|
# If there's no config file by that name, mv it over:
|
||||||
|
if [ ! -r $OLD ]; then
|
||||||
|
mv $NEW $OLD
|
||||||
|
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy
|
||||||
|
rm $NEW
|
||||||
|
fi
|
||||||
|
# Otherwise, we leave the .new copy for the admin to consider...
|
||||||
|
}
|
||||||
|
|
||||||
|
config etc/wgetrc.new
|
||||||
|
|
26
buildsamples/sample.SMBuild
Executable file
26
buildsamples/sample.SMBuild
Executable file
|
@ -0,0 +1,26 @@
|
||||||
|
APP=
|
||||||
|
VERSION=
|
||||||
|
BUILD=1sml
|
||||||
|
HOMEPAGE=""
|
||||||
|
DOWNLOAD=""
|
||||||
|
REQUIRES=""
|
||||||
|
|
||||||
|
build() {
|
||||||
|
mkandenterbuilddir
|
||||||
|
rm -rf $APP-$VERSION
|
||||||
|
|
||||||
|
tar xf $SRCDIR/$APP-$VERSION.tar.?z*
|
||||||
|
cd $APP-$VERSION
|
||||||
|
fixbuilddirpermissions
|
||||||
|
|
||||||
|
./configure \
|
||||||
|
--prefix="" \
|
||||||
|
--sysconfdir=/etc
|
||||||
|
|
||||||
|
make
|
||||||
|
make install DESTDIR=$PKG
|
||||||
|
|
||||||
|
cp LICENSE $PKGDOCS/
|
||||||
|
|
||||||
|
mkfinalpkg
|
||||||
|
}
|
170
buildsamples/sample.SMBuild.explained
Executable file
170
buildsamples/sample.SMBuild.explained
Executable file
|
@ -0,0 +1,170 @@
|
||||||
|
# This is a simple SMLinux-compatible build file with all the necessary explanation
|
||||||
|
# for helping users quickly understand the build system while referring to the bldpkg
|
||||||
|
# file and to start building and using SMLinux distro packages. Experienced slackware
|
||||||
|
# users may find this file more familiar and can therefore parse more quickly.
|
||||||
|
|
||||||
|
# Simplified build file logic for slackware and non-slackware users:
|
||||||
|
# a. Invoke the build file, ./openssh.SMBuild without any arguments
|
||||||
|
# b. Script is invoked in sh/bash
|
||||||
|
# c. Define APP, VERSION and BUILD variables
|
||||||
|
# d. Optionally add and define SM_DISTCC, SM_CCACHE and SM_DEBUG variables
|
||||||
|
# e. BUILDVARS variable, unless it is null, is sourced, or /etc/bldpkg.conf file is sourced
|
||||||
|
# f. makebuilddirs function removes old package build directory, makes a new one and cd's into $TMP
|
||||||
|
# g. Old source directory is removed from $TMP and new one is extracted into it
|
||||||
|
# h. fixsrcdirpermissions function fixes any permissions inside the new source directory
|
||||||
|
# i. Usual compile options like ./configure --prefix="" ; make ; make install DESTDIR=$PKG
|
||||||
|
# are added defined by the user
|
||||||
|
# j. Any runit service files, if optionally needed, are added by invoking the preprunitservice
|
||||||
|
# function
|
||||||
|
# k. makefinalpkg function prepares the final package directory and places it inside $PKGDEST
|
||||||
|
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
APP=openssh
|
||||||
|
# ^ define the application name to be built/compiled and packaged.
|
||||||
|
# **This variable must be defined.**
|
||||||
|
VERSION=8.1
|
||||||
|
# ^ define the application's version number
|
||||||
|
# **This variable must be defined.**
|
||||||
|
BUILD=1sml
|
||||||
|
# ^ define the build tag and count of the package in case changes are being introduced
|
||||||
|
# to this build file while the version is still the same. The count is incremented
|
||||||
|
# everytime a change is made to the build file. If the version is different, reset
|
||||||
|
# this to 1sml for the new version and increment from there on if changes are made again.
|
||||||
|
# **This variable must be defined.**
|
||||||
|
|
||||||
|
SM_DISTCC=0
|
||||||
|
# ^ This variable, when set to 0, will cause the build system to not use distcc
|
||||||
|
# for building this particular package. See also how SM_GLOBALDISTCC variable
|
||||||
|
# in bldpkg.conf affects this option.
|
||||||
|
# This variable is optional.
|
||||||
|
|
||||||
|
SM_CCACHE=0
|
||||||
|
# ^ This variable, when set to 0, will cause the build system to not use ccache
|
||||||
|
# for building this particular package. See also how SM_GLOBALCCACHE variable
|
||||||
|
# in bldpkg.conf affects this option.
|
||||||
|
# This variable is optional.
|
||||||
|
|
||||||
|
SM_DEBUG=1
|
||||||
|
# ^ This variable, when set to 1, will produce a debug build by preserving any
|
||||||
|
# debug symbols in the binaries and libraries contained in $PKG.
|
||||||
|
# Default is to strip all binaries and libraries.
|
||||||
|
# This variable is optional.
|
||||||
|
|
||||||
|
SM_NOAUTOCONFSITE=1
|
||||||
|
# ^ This variable, when set to 1, will disable exporting of the CONFIG_SITE variable.
|
||||||
|
# CONFIG_SITE points to a file path defined in bldpkg.conf that holds predefined answers
|
||||||
|
# to various configure tests. Use it if a package's configure script returns errors
|
||||||
|
# which it normally wouldn't when the cache file was not used.
|
||||||
|
# This variable is optional.
|
||||||
|
|
||||||
|
HOMEPAGE=""
|
||||||
|
# ^ Add Homepage URL or website of the author of package to this
|
||||||
|
|
||||||
|
DOWNLOAD=""
|
||||||
|
# ^ Add Download URL of the package source ( can be tar.xz or tar.gz or any of the tarballs /
|
||||||
|
# zipfiles available
|
||||||
|
|
||||||
|
DESC=""
|
||||||
|
# ^ Add a brief description of what the package is about
|
||||||
|
|
||||||
|
REQUIRES=""
|
||||||
|
# ^ Add runtime dependencies to this variable, each dependency separated by a space
|
||||||
|
|
||||||
|
build() {
|
||||||
|
# ^ Start of the "build" function. This function lists the steps for the order in which to compile
|
||||||
|
# a given package. The order basically consists of invoking other functions that are defined
|
||||||
|
# in bldpkg.d.
|
||||||
|
|
||||||
|
compileonlyfor x86_64
|
||||||
|
# ^ Function defined in and sourced from bldpkg to compile the application only on
|
||||||
|
# a predefined architecture or exit with a code 1 if determined otherwise.
|
||||||
|
|
||||||
|
mkandenterbuilddir
|
||||||
|
# ^ Function defined in and sourced from bldpkg.conf to prepare the package directories. Similar
|
||||||
|
# to SlackBuild's rm -rf $TMP/package-$APP ; mkdir $TMP/package-$APP, but in addition to that,
|
||||||
|
# it also creates the PKGDOCS directory that may contain a copy of this build file and
|
||||||
|
# LICENSEs and READMEs if any, as defined by the user later in the build, and PKGDEST directory,
|
||||||
|
# where the final package will be put into. When that is done, this function will *cd into $TMP*
|
||||||
|
# ** This function is necessary for most builds** unless you have a compelling reason to preserve
|
||||||
|
# old source directories.
|
||||||
|
|
||||||
|
|
||||||
|
rm -rf $APP-$VERSION
|
||||||
|
# ^ remove the old source directory inside *$TMP/$APP.src*
|
||||||
|
|
||||||
|
|
||||||
|
tar xf $SRCDIR/$APP-$VERSION.tar.?z*
|
||||||
|
# ^ Extract the source tarball from $SRCDIR, in effect creating a new source directory inside $TMP.
|
||||||
|
# This source directory is useful when you have to delete further extracted source directories,
|
||||||
|
# because this directory is unique, and when using TMPFS, the build system can delete this
|
||||||
|
# directory specifically instead of attempting to hunt for source directories it contains.
|
||||||
|
# For example: /tmp/tmpfsdir/glib.src/glib-2.99
|
||||||
|
# In this path, when using TMPFS, the build system will delete /tmp/tmpfsdir/glib.src instead
|
||||||
|
# of deleting glib-2.99.
|
||||||
|
|
||||||
|
|
||||||
|
cd $APP-$VERSION
|
||||||
|
# ^ cd into $TMP/$APP.src/$APP-$VERSION
|
||||||
|
|
||||||
|
|
||||||
|
fixbuilddirpermissions
|
||||||
|
# ^ Function defined in and sourced from bldpkg to fix permissions inside the newly extracted
|
||||||
|
# build directory
|
||||||
|
# ** This function is necessary **
|
||||||
|
|
||||||
|
|
||||||
|
./configure \ --------+
|
||||||
|
--prefix="" \ |
|
||||||
|
--sysconfdir=/etc |
|
||||||
|
|
|
||||||
|
make |
|
||||||
|
make install DESTDIR=$PKG |
|
||||||
|
|
|
||||||
|
# OR |
|
||||||
|
| <- the usual compile stuff that goes into building the package
|
||||||
|
mkdir -p build && cd build | prior to installing it into $PKG
|
||||||
|
meson .. \ |
|
||||||
|
--prefix="" \ |
|
||||||
|
-Ddocs=false |
|
||||||
|
|
|
||||||
|
ninja |
|
||||||
|
DESTDIR="$PKG" ninja install ------+
|
||||||
|
|
||||||
|
|
||||||
|
preprunitservice <openssh> <down> <finish>
|
||||||
|
# ^ Function defined in and sourced from bldpkg to create etc/service/<service> and var/service/<service>
|
||||||
|
# directories and symlinks, and to copy the service.run and service.finish file to appropriate runit-aware
|
||||||
|
# locations.
|
||||||
|
# preprunitservice is the name of the function with three possible arguments:
|
||||||
|
# $1 - openssh, defines the name of the runit service
|
||||||
|
# $2 - down, defines whether to add a "down" file in var/service/<service> to prevent its execution in
|
||||||
|
# the current session or at the next boot
|
||||||
|
# $3 - finish, defines whether to add a "finish" file to cause runit to cleanly terminate the service.
|
||||||
|
# when told. The "finish" file should have all the cleanup routines defined.
|
||||||
|
# This function and its arguments are optional
|
||||||
|
|
||||||
|
|
||||||
|
removestaticlibs
|
||||||
|
# ^ Function to forcefully discard any static libraries in case explicitly disabling building them doesn't work
|
||||||
|
|
||||||
|
|
||||||
|
mkfinalpkg
|
||||||
|
# ^ Function defined in and sourced from bldpkg to:
|
||||||
|
# a. Copy post-install files like slack-{desc,required} and doinst.sh
|
||||||
|
# b. Compress and link man pages
|
||||||
|
# c. Determine whether to strip or produce a debug build
|
||||||
|
# d. Provide a copy of this entire build file insode $PKGDOCS
|
||||||
|
# e. Generate the final smlinux-compatible package inside $PKGDEST
|
||||||
|
# f. Generate a build summary including time when the build started, stopped, whether distcc or ccache
|
||||||
|
# was used, compressed/uncompressed sizes of the final package if the build completed successfully,
|
||||||
|
# number of CPU threads, distcc options if any, build type (whether it was a debug build or not).
|
||||||
|
# Note: the output of this summary will also be generated when the user invokes ctrl-C aka SIGINT
|
||||||
|
# anytime during the build and the output may slightly vary. Kindly refer to bldpkg for more info.
|
||||||
|
# ** This function is necessary **
|
||||||
|
|
||||||
|
}
|
||||||
|
# Closing brace for the build function.
|
||||||
|
|
||||||
|
# END OF THE BUILD FILE
|
Loading…
Reference in a new issue