summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorXenHat2023-11-19 13:12:45 -0500
committerXenHat2023-11-19 13:12:45 -0500
commit903c08ff80a688de91e4b50d3077c43b88cea121 (patch)
tree82affbd49abb59fe722637c1220da41d7c1a8eb3
parent2ed3ecf84124a0ae7ac8d11e182d94068183de35 (diff)
downloadaur-903c08ff80a688de91e4b50d3077c43b88cea121.tar.gz
update pkgbuild from template
-rw-r--r--.SRCINFO4
-rwxr-xr-xPKGBUILD170
2 files changed, 89 insertions, 85 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 02ff34072424..e96891019bb4 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -7,18 +7,16 @@ pkgbase = alchemy-next-viewer-git
arch = x86_64
license = LGPL
makedepends = gcc
- makedepends = python-virtualenv
makedepends = python-pip
makedepends = git
- makedepends = xz
depends = glu
depends = libgl
depends = libiconv
depends = libidn
depends = libjpeg-turbo
depends = libpng
- depends = libxss
depends = libxml2
+ depends = libxss
depends = mesa
depends = nss
depends = openal
diff --git a/PKGBUILD b/PKGBUILD
index 5565ddf448ef..9e60db9e72f0 100755
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -13,8 +13,8 @@ url="https://www.alchemyviewer.org"
install=alchemy.install
# template end;
# template start; name=deps; version=1.0;
-depends=(glu libgl libiconv libidn libjpeg-turbo libpng libxss libxml2 mesa nss openal sdl2 vlc zlib)
-makedepends=('gcc' 'python-virtualenv' 'python-pip' 'git' 'xz')
+depends=('glu' 'libgl' 'libiconv' 'libidn' 'libjpeg-turbo' 'libpng' 'libxml2' 'libxss' 'mesa' 'nss' 'openal' 'sdl2' 'vlc' 'zlib')
+makedepends=('gcc' 'python-pip' 'git')
optdepends=(
'alsa-lib: ALSA support'
'freealut: OpenAL support'
@@ -37,7 +37,7 @@ replaces=('alchemy-viewer-git')
provides=('alchemy-viewer')
source=("${pkgname}"::'git+https://git.alchemyviewer.org/alchemy/alchemy-next.git#branch='"${AL_BRANCH_OVERRIDE:-main}")
sha256sums=('SKIP')
-depends+=(dbus-glib systemd-libs)
+depends+=('dbus-glib' 'systemd-libs')
conflicts+=("alchemy-next-viewer-nosystemd-git")
# template start; name=pkgver; version=1.0;
@@ -56,11 +56,11 @@ pkgver() {
# template start; name=prepare; version=1.0;
prepare() {
cd ${srcdir} || exit
- msg2 "Creating virtual environment in $PWD"
+ echo "Creating virtual environment in $PWD"
virtualenv ".venv" -p python3
source "${srcdir}/.venv/bin/activate"
- msg2 "Installing build toolchain..."
+ echo "Installing build toolchain..."
pip3 install --upgrade cmake llbase llsd certifi autobuild ninja
}
# template end;
@@ -68,85 +68,91 @@ prepare() {
# template start; name=build; version=1.0;
build() {
cd "${pkgname}" || exit 1
- msg2 "Configuring build environment..."
- _logfile="${srcdir}/build.${CARCH}.$(date +%s).log"
source "${srcdir}/.venv/bin/activate"
- build_jobs=$(nproc)
- if [[ -z "$NO_SMART_JOB_COUNT" ]]; then
- if [[ ${build_jobs} -gt 1 ]]; then
- jobs=1
- # The viewer requires an average of 2GB of memory per core to link
- # Note: Behaviour change compared to the previous versions:
- # This script will no longer try to allocate build memory into swap
- # This is bad practice, and swap should be reserved to evict process
- # memory from physical ram to make place for the current workset.
- # This script will now try to check if swap is present and sufficent
- # for the current used memory to be stored in swap before allocating,
- # and will fallback to conservative allocation if swap is not available
- gigperlinkprocess=2
- mempercorekb=$((gigperlinkprocess * 1048576))
- requiredmemorykb=$(($(nproc) * mempercorekb))
- free_output="$(free --kilo --total | tail -n+2 | tr -s ' ')"
- physical_output=$(grep "Mem:" <<<"$free_output")
- #total_output=$(grep Total: <<< "$free_output")
- usedmemorykbphysical=$(cut -d ' ' -f 3 <<<"$physical_output")
- totalmemorykbphysical=$(cut -d ' ' -f 2 <<<"$physical_output")
- swap_output=$(grep Swap: <<<"$free_output")
- # Determine available swap space
- availableswapkb=0
- if [[ -n "$swap_output" ]]; then
- availableswapkb=$(cut -d ' ' -f 4 <<<"$swap_output")
- fi
- availablememorykbphysical=$(cut -d ' ' -f 7 <<<"$free_output")
-# msg2 "Total memory: $totalmemorykbphysical (includes swap)"
-# msg2 "Available memory: $availablememorykbphysical"
-# msg2 "Required memory: $requiredmemorykb"
-# msg2 "Available physical memory on this system: $((availablememorykbphysical / 1024 / 1024)) GB"
-# msg2 "Estimated required memory to build with all cores: $((requiredmemorykb / 1024 / 1024)) GB"
- if [[ ${requiredmemorykb} -gt ${availablememorykbphysical} ]]; then
-# msg2 "Warning: Not enough available physical memory to build with all cores"
- if [[ ${usedmemorykbphysical} -lt ${availableswapkb} ]]; then
- # use all physical ram as swap will do its job
-# msg2 "There is enough free swap to store the currently used memory"
- jobs=$(((totalmemorykbphysical / 1024 / 1024) / gigperlinkprocess))
- else
- # Not enough swap to hold ram contents, calculate manually
-# msg2 "Allocating build jobs according to available physical memory ("$((availablememorykbphysical / 1024 / 1024))"/"$((requiredmemorykb / 1024 / 1024))"GB)..."
- # FIXME: Goes one iteration beyond what it should
- while [[ $((jobs * mempercorekb)) -lt ${availablememorykbphysical} ]]; do
- jobs=$((jobs + 1))
- msg2 "${jobs} jobs would consume $(((jobs * mempercorekb) / 1024 / 1024))GB"
- done
- # Back off one job count. Not sure why I have to do this but
- # the loop is doing one extra iteration.
- jobs=$((jobs - 1))
- fi
- build_jobs=${jobs}
-# msg2 "Adjusted job count: ${build_jobs}"
- fi
- fi
- fi
- export AUTOBUILD_CPU_COUNT=$build_jobs
- AL_CMAKE_CONFIG=(
- -DLL_TESTS:BOOL=ON
- -DDISABLE_FATAL_WARNINGS=ON
- -DUSE_LTO:BOOL=OFF
- -DVIEWER_CHANNEL="Alchemy Test"
- )
- #msg2 "BUILDENV: ${BUILDENV[*]}"
- # if [[ " ${BUILDENV[*]} " =~ ' ccache ' ]] && command -v ccache >/dev/null 2>&1; then
- AL_CMAKE_CONFIG+=("-DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache)")
- msg2 "ccache was found and will be used"
- # fi
- if command -v clang++ >/dev/null 2>&1; then
- AL_CMAKE_CONFIG+=("-DCMAKE_C_COMPILER=$(which clang)")
- AL_CMAKE_CONFIG+=("-DCMAKE_CXX_COMPILER=$(which clang++)")
- msg2 "clang was found and will be used instead of gcc"
+echo ""
+echo "Configuring the build"
+
+_logfile="build.${CARCH}.$(date +%s).log"
+build_jobs=$(nproc)
+
+AL_CMAKE_CONFIG=(
+ -DLL_TESTS:BOOL=ON
+ -DDISABLE_FATAL_WARNINGS=ON
+ -DUSE_LTO:BOOL=OFF
+ -DVIEWER_CHANNEL="Alchemy Test"
+)
+
+if [[ " ${BUILDENV[*]} " =~ ' ccache ' ]] && command -v ccache >/dev/null 2>&1; then
+ AL_CMAKE_CONFIG+=("-DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache)")
+ echo "ccache was found and will be used"
+fi
+if [[ -z "$NO_CLANG" ]] && command -v clang++ >/dev/null 2>&1; then
+ AL_CMAKE_CONFIG+=("-DCMAKE_C_COMPILER=$(which clang)")
+ AL_CMAKE_CONFIG+=("-DCMAKE_CXX_COMPILER=$(which clang++)")
+ echo "clang was found and will be used instead of gcc"
+fi
+
+if [[ -z "$NO_SMART_JOB_COUNT" ]]; then
+ if [[ ${build_jobs} -gt 1 ]]; then
+ # The viewer requires an average of 2GB of memory per core to link
+ # Note: Behaviour change compared to the previous versions:
+ # This script will no longer try to allocate build memory into swap
+ # This is bad practice, and swap should be reserved to evict process
+ # memory from physical ram to make place for the current workset.
+ # This script will now try to check if swap is present and sufficent
+ # for the current used memory to be stored in swap before allocating,
+ # and will fallback to conservative allocation if swap is not available
+ mempercorekb=$((1048576))
+ requiredmemorykb=$(($(nproc) * mempercorekb))
+ free_output="$(free --kilo --total | tail -n+2 | tr -s ' ')"
+ physical_output=$(grep "Mem:" <<<"$free_output")
+ totalmemorykbphysical=$(cut -d ' ' -f 2 <<<"$physical_output")
+ usedmemorykbphysical=$(cut -d ' ' -f 3 <<<"$physical_output")
+ # Don't factor in the caches, these will be flushed as needed
+ #freememorykbphysical=$(cut -d ' ' -f 4 <<<"$physical_output")
+ availablememorykbphysical=$(cut -d ' ' -f 7 <<<"$free_output")
+ total_output=$(grep "Total:" <<<"$free_output")
+ totalmemorykbcombined=$(cut -d ' ' -f 2 <<<"$total_output")
+ usedmemorytotal=$(cut -d ' ' -f 2 <<<"$total_output")
+ freememorytotal=$(cut -d ' ' -f 4 <<<"$total_output")
+ swap_output=$(grep Swap: <<<"$free_output")
+ # Determine available swap space
+ availableswapkb=0
+ if [[ -n "$swap_output" ]]; then
+ availableswapkb=$(cut -d ' ' -f 4 <<<"$swap_output")
+ fi
+ echo "Required memory at $(nproc) jobs: $((requiredmemorykb/1024/1024))GB"
+ echo "Available memory (counting swap): $((totalmemorykbcombined/1024/1024))GB"
+ echo "Total RAM: $((totalmemorykbphysical/1024/1024))GB"
+ if [[ ${requiredmemorykb} -gt ${totalmemorykbphysical} ]]; then
+ echo "Not enough physical memory to use all cores"
+ if [[ ${usedmemorykbphysical} -lt ${availableswapkb} ]]; then
+ # There is enough swap to fit all the used memory. Use all physical ram as swap will do its job
+ echo "Using swap memory to store current processes memory"
+ # We do not want to compile in swap, so adjust accordingly
+ jobs=$(((totalmemorykbphysical) / mempercorekb))
+ else
+ # TODO: Verify this logic on low-ram systems
+ # Not enough swap to hold ram contents, calculate manually
+ jobs=1
+ echo "${jobs} job would consume $(((jobs * mempercorekb) / 1024 / 1024))GB"
+ while [[ $((jobs * mempercorekb)) -le ${availablememorykbphysical} ]]; do
+ ((jobs++))
+ echo "${jobs} jobs would consume $(((jobs * mempercorekb) / 1024 / 1024))GB"
+ done
+ # Back off one job count. Not sure why I have to do this but
fi
- msg2 "Configuring the build"
- $prefix_cmd autobuild configure -A 64 -c ReleaseOS -- "${AL_CMAKE_CONFIG[@]}" > >(tee -a "$_logfile") 2> >(tee -a "$_logfile" >&2)
- msg2 "Starting the build with ${AUTOBUILD_CPU_COUNT} jobs"
- $prefix_cmd autobuild build -A 64 -c ReleaseOS --no-configure > >(tee -a "$_logfile") 2> >(tee -a "$_logfile" >&2)
+ build_jobs=${jobs}
+ fi
+ fi
+ echo "Adjusted job count: ${build_jobs}"
+fi
+export AUTOBUILD_CPU_COUNT=$build_jobs
+
+# And now we configure and build the viewer with our adjusted configuration
+autobuild configure -A 64 -c ReleaseOS -- "${AL_CMAKE_CONFIG[@]}" > >(tee -a "$_logfile") 2> >(tee -a "$_logfile" >&2)
+echo "Building with ${AUTOBUILD_CPU_COUNT} jobs"
+autobuild build -A 64 -c ReleaseOS --no-configure > >(tee -a "$_logfile") 2> >(tee -a "$_logfile" >&2)
}
# template end;