spkgbuild

spkgbuild is build script sourced by buildpkg to build the package. The example of spkgbuild as follows:

# description	: This is example package
# backup	: etc/example.conf etc/foobar.conf
# depends	: package1 package2 package3
# noextract	: example.tar.gz foobar.tar.xz

name=foobar
version=1.0.0
release=1
options=(!makeflags libtool)
source=(https://dl.example.com/foobar.tar.xz
        $name-$version.tar.gz::https://github.com/achieve/$version.tar.gz
        example.conf)

build() {
    cd $name-$version

    ./configure --prefix=/usr
    make
    make DESTDIR=$PKG install

    install -d $SRC/example.conf $PKG/etc/example.conf
}

Note: When create new package, its recommended to build using fakeroot first to make sure the build script is not broken and leave untracked file inside system.

spkgbuild format:

Package options

This options is set in /etc/scratchpkg.conf for global options:

OPTIONS=()

For per package, set options in package’s spkgbuild:

options=()

Add ! in front of options to disable it, example for disable strip and remove empty directory in package (per package) as follows:

options=(!strip !emptydirs)

Available options:

libtool:     Keep libtool file (*.la) in packages.
emptydirs:   Keep empty directories in packages.
strip:       Strip symbols from binaries/libraries.
purge:       Remove files specified in PURGE_FILES.
zipman:      Compress manual (man and info) pages in MAN_DIRS with gzip.
buildflags:  Enable buildflags (CFLAGS and CXXFLAGS).
makeflags:   Enable makeflags (MAKEFLAGS).