# /etc/bldpkg.conf
# Part of the SMLinux distribution

# This file allows you to define paths and variable values and prepares a 
# complete build environment for creating SMLinux-compatible packages

# Please refer to sample.SMBuild.explained in the buildsamples directory 
# for complete explanation.

sections=(base xorg gtk extra net xfce)

# Set the package extension. Makepkg will use this to figure out the 
# compression utility. Pick one out of tbz/tgz/txz/tlz. 
pkgext="tlz"

# Set compressor options. These will be exported in the mkfinalpkg function 
# for makepkg to pickup.
compressor="plzip"
compressoropts="-0c"

# Set this variable if you wish to be prompted for installing (or upgrading) 
# the package after it has been built successfully. 0 to disable, 1 to 
# enable. Ignored for SSB autobuilds.
installprompt=0

# Set this variable if you wish to be prompted for extracting contents of 
# the newly-built package installer file into a new subdirectory called 
# "test" within the current source directory the build was invoked from. 0 
# to disable, 1 to enable. Ignored for SSB autobuilds.
extractprompt=0

# Define your compilers here.
CC="gcc"
CXX="g++"

# Set CPU-specific compiler variables. Only aarch64 and x86_64 supported. 
# https://github.com/sakaki-/gentoo-on-rpi-64bit/blob/master/reference/compile_run_benchmarks.sh
# https://www.raspberrypi.org/forums/viewtopic.php?t=11629
# Set debug flag
gccdebug="-g3"

# For aarch64
# aarch64-musl-linux is not recognised by most configure scripts and I haven't
# seen any compile except for gmp going wrong with arm-musl-linux
# Cause: packages that require this have prehistoric config.guess files
builddist="--build=arm-musl-linux"
# Uncomment as needed. For aarch64
CFLAGS="-O2 -fPIC -pipe -march=armv8-a+crc -mtune=cortex-a53"

# For x86_64
#builddist="--build=x86_64-musl-linux"
#CFLAGS="-O2 -fPIC -pipe"

# Whether to use ccache for faster consecutive rebuilds. Set 0 to disable, 
# 1 to enable.
ccache=0

# Whether to use sccache for faster consecutive builds. Set 0 to disable,
# 1 to enable
sccache=0

# Whether to use distcc for distributed compilations. 0 to disable, 1 to 
# enable.
distcc=0

# Ccache binary location
ccachebinpath="/bin/ccache"
# Ccache symlink paths created for cc/gcc/c++/g++
ccachesymdirpath="/lib/ccache"

# Sccache binary location
sccachebinpath="/bin/sccache"
# Scache hardlink paths created for cc/gcc/c++/g++
sccachepath="/opt/sccache/bin"

# Distcc binary location
distccbinpath="/bin/distcc"
# Distcc symlink paths created for cc/gcc/c++/g++
distccsymdirpath="/lib/distcc"

# Define the distcc timeout period in seconds. This prevents distcc from 
# falling back to local compiler if a distributed job takes a long time to 
# complete. We set it to 30 minutes instead of 5 minutes which is default.
DISTCC_IO_TIMEOUT="1800"

# Define network hosts who will take part in the compile. Please refer to 
# distcc manual for complete info. Must be defined in /etc/hosts unless they
# are an IP. Tip: Distcc by default will use only 2 cores on the local 
# machine.
DISTCC_HOSTS="localhost/2 host/2,lzo"

# Add sum total of the above CPU cores/threads or add your own count 
# prepended with "-j". 
MAKEFLAGS="-j4"

# Declare a parent temporary directory
parenttmp="/tmp"

# Whether to use tmpfs for the package build. The package source will be
# extracted and compiled inside the tmpfs directory and ccache will be 
# disabled to prevent writes to the disk. 1 to enable, 0 to disable.
tmpfs=0

# Set the tmpfs directory if the above variable is enabled
tmpfsdir="$parenttmp/tmpfsdir"

# Define the nontmpfs base directory
nontmpfsdir="$parenttmp/sml"

# Directory where the final package installer, example: 
# openssh-8.1-x86_64-1sml.tlz should be placed in. Again, should be outside 
# tmpfs dir. Also declared and defined in autobuild section file, so values 
# may differ. This is for manual builds.
pkgdest="$parenttmp/sml/packages/"

# Whether you want to preserve the build directory which contains the extracted source, 
# for example /tmp/sml/openssh.src/openssh-8.1. usetmpfs variable, if set to 1, will
# auto-reset this variable to 0 and the directory will be deleted. Set 1 to 
# preserve it, 0 to rm -rf it automatically at the end of each build
preservebuilddir=1

# Whether you want to preserve the package staging directory. for example 
# /tmp/sml/package-openssh. usetmpfs variable, if set to 1, will auto-reset this 
# variable to 0 and the directory will be deleted. Set 1 to preserve it, 0 to 
# rm -rf it automatically at the end of each build
preservepackagedir=1

# Whether to show build summary. Set to 1 to enable, 0 to disable.
showsummary=1

# Whether to show colours in the build summary. Set 1 to enable, 0 to 
# disable. Also, only show colours if the build is invoked manually and not 
# through the SSB autobuild system where logging is automatic or when 
# logging is invoked using log ./<package.SMBuild>.
[ -z "$colours" ] && colours=1

# Define whether to check for swap. 1 to enable, 0 to disable.
swapcheck=0

# If above variable is set to 1, define swap size required for huge 
# compiles in KiB
swapsize=2048000

# Set path to configure cache file that contains predefined answers to several
# tests autoconf scripts run. Credits: Sabotage Linux. 
configsite="/etc/config.cache"

# Whether to check for build/runtime dependencies
checkdependencies=0

# This array lists the packages whose sources will not be extracted and 
# compiled inside tmpfs, if tmpfs is <= 2GB. If your tmpfs is >= 2GB, empty
# out this entire list.
tmpfsexceptionlist=( mozjs nodejs firefox wxwidgets palemoon qemu dovecot gdb gnumeric \
gtk+2 gtk+3 guile llvm mariadb mesa mesa-demos mupdf perl postfix python2 \
python3 rtorrent spice python-lxml kernel libreoffice mono \
qtwebengine kernel-source rust webkitgtk boost go )

# This array lists the packages which require additional swap for
# compilation to prevent the system from becoming completely unresponsive 
# for want of more memory.
packagesrequiringswap=( mozjs nodejs firefox palemoon qemu gdb gnumeric gtk+2 \
gtk+3 guile llvm mariadb mesa mupdf libtorrent rtorrent \
qtwebengine )

# This array is to protect important system directories from being rm -rf'd 
# accidentally. Sometimes you never know what value the variable being 
# expanded as an argument for rm -rf holds, so prevention is better. 
# Populate this list appropriately and use it inside an if/else whenever 
# rm -rf is about to be called.
protecteddirectories=( "/" "/bin" "/boot" "/dev" "/etc" "/home" "/include" \
"/lib" "/libexec" "/local" "/man" "/media" "/mnt" "/opt" "/proc" \
"/root" "/run" "/sbin" "/share" "/srv" "/sys" "/usr" "/var" )

# Find initial compile-related build files. If either of don't exist, abort.
rqfiles=( installpkg upgradepkg sha512sum patch find findmnt patch tput bc tar \
addr2line ar as c++ c++filt cc cpp elfedit g++ gcc gcc-ar gcc-nm gcc-ranlib gcov \
gcov-tool getconf gprof iconv ld ld.bfd nm objcopy objdump ranlib readelf size \
strings strip scanelf )


# Whether to output application build status in HTML format. Set 1 to enable,
# 0 to disable.
htmloutput=0

# Be verbose about compiler output. Make and Cmake currently supported.
verbosebuild=0

# Whether to prompt a user to resume a build if 
# $tmp/src/.$app-$version.extraction.complete is found or to build the package from scratch
autoresumepkgbuild=0
