diff options
-rw-r--r-- | .SRCINFO | 10 | ||||
-rw-r--r-- | PKGBUILD | 53 | ||||
-rwxr-xr-x | compile.bash | 55 |
3 files changed, 79 insertions, 39 deletions
@@ -1,11 +1,12 @@ pkgbase = alchemy-viewer pkgdesc = This is the next generation of Alchemy Viewer! - pkgver = 6.5.2.48000 - pkgrel = 6 + pkgver = 6.5.5_r48681.g12c2a9b7e9 + pkgrel = 1 url = https://www.alchemyviewer.org install = alchemy.install arch = x86_64 license = LGPL + makedepends = coreutils makedepends = cmake makedepends = gcc makedepends = python-virtualenv @@ -41,14 +42,15 @@ pkgbase = alchemy-viewer optdepends = mesa-libgl: Intel, Radeon, Nouveau support optdepends = nvidia-libgl: NVIDIA support optdepends = nvidia-utils: NVIDIA support + provides = alchemy-viewer replaces = alchemy-next-viewer options = !emptydirs options = !makeflags options = !strip options = !lto source = alchemy-viewer::git+https://git.alchemyviewer.org/alchemy/alchemy-next.git#branch=main - md5sums = SKIP - sha256sums = SKIP + source = compile.bash b2sums = SKIP + b2sums = b03a84626d849b87fdc012cdee3743d4bc60ffd9cf865f99b7db58fe5fef9fa98e476277ac73f554ffa16a8fdc0b0304b8a93e1d8e62e48b1c79c8b9d18f3f75 pkgname = alchemy-viewer @@ -4,14 +4,14 @@ # Maintainers: Xenhat Hex (me@xenh.at), Justin Jagieniak <justin@jagieniak.net> # shellcheck disable=2034,3030,2154 pkgname=alchemy-viewer -pkgver=6.5.2.48000 -pkgrel=6 +pkgver=6.5.5_r48681.g12c2a9b7e9 +pkgrel=1 pkgdesc="This is the next generation of Alchemy Viewer!" arch=('x86_64') url=https://www.alchemyviewer.org license=('LGPL') depends=(dbus-glib glu gtk3 libgl libidn libjpeg-turbo libpng libxss libxml2 mesa nss openal sdl2 vlc zlib) -makedepends=('cmake' 'gcc' 'python-virtualenv' 'python-pip' 'git' 'boost' 'xz' 'ninja' 'sed') +makedepends=('coreutils' 'cmake' 'gcc' 'python-virtualenv' 'python-pip' 'git' 'boost' 'xz' 'ninja' 'sed') optdepends=( 'alsa-lib: ALSA support' 'freealut: OpenAL support' @@ -23,20 +23,22 @@ optdepends=( 'libpulse: PulseAudio support' 'mesa-libgl: Intel, Radeon, Nouveau support' 'nvidia-libgl: NVIDIA support' -'nvidia-utils: NVIDIA support') + 'nvidia-utils: NVIDIA support') replaces=('alchemy-next-viewer') +provides=('alchemy-viewer') options=(!emptydirs !makeflags !strip !lto) install=alchemy.install -source=("${pkgname}"::'git+https://git.alchemyviewer.org/alchemy/alchemy-next.git#branch=main') -md5sums=('SKIP') -sha256sums=('SKIP') -b2sums=('SKIP') +source=("${pkgname}"::'git+https://git.alchemyviewer.org/alchemy/alchemy-next.git#branch='"${AL_BRANCH_OVERRIDE:-main}" +'compile.bash') +b2sums=('SKIP' + 'b03a84626d849b87fdc012cdee3743d4bc60ffd9cf865f99b7db58fe5fef9fa98e476277ac73f554ffa16a8fdc0b0304b8a93e1d8e62e48b1c79c8b9d18f3f75') pkgver() { cd "${pkgname}" || exit 1 ( set -o pipefail git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' || - printf "%s.%s" "$(cat indra/newview/VIEWER_VERSION.txt)" "$(git rev-list --count HEAD)" + # At the moment, git tags are sorely underused, fake a semver-friendly one + printf "%s_r%s.g%s" "$(cat indra/newview/VIEWER_VERSION.txt)" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" ) } @@ -45,40 +47,21 @@ prepare() { git fetch --prune git checkout main git pull --autostash - git checkout "${AL_GIT_BRANCH:-fb451f141d}" + if [ -z "$AL_BRANCH_OVERRIDE" ]; then + git checkout "${AL_COMMIT_OVERRIDE:-12c2a9b7e90024f2990956ba0d0efff42d2b45bc}" + else + git checkout "${AL_COMMIT_OVERRIDE:-HEAD}" + fi } build() { cd "${pkgname}" || exit 1 - virtualenv ".venv" -p python3 - source ".venv/bin/activate" - if command -v autobuild; then - abver="$(autobuild --version)" - echo "Found ${abver}" - if [ "${abver}" = "autobuild 2.1.0" ]; then - echo "Reinstalling autobuild to work around some bugs" - pip3 uninstall --yes autobuild - fi - fi - pip3 install --upgrade autobuild -i https://git.alchemyviewer.org/api/v4/projects/54/packages/pypi/simple --extra-index-url https://pypi.org/simple - # we have a lot of files, relax ulimit to help performance - ulimit -n 20000 - # shellcheck disable=SC2153 - autobuild configure -A 64 -c ReleaseOS -- -DLL_TESTS:BOOL=OFF -DDISABLE_FATAL_WARNINGS=ON -DUSE_LTO:BOOL="$(grep -cq '[^!]lto' <<< "${OPTIONS}" && echo 'ON' || echo 'OFF')" -DVIEWER_CHANNEL="Alchemy Test" - cd "build-linux-64" || exit 1 - loadavg=$(nproc) - if [[ $loadavg -gt 1 ]]; then - if [[ $loadavg -le 8 ]]; then loadavg=$((loadavg - 1)) - else - loadavg=$((loadavg - 2)) - fi - fi - time ninja -l${loadavg} + ../../compile.bash "${OPTIONS}" } package() { mkdir -p "${pkgdir}/opt" mkdir -p "${pkgdir}/usr/local/share/applications" - sed -i 's;alchemy-.*\.desktop;'"${pkgname}\.desktop"';' "${pkgname}/build-linux-64/newview/packaged/etc/refresh_desktop_app_entry.sh" + sed -i 's;alchemy-viewer\.desktop;'"${pkgname}\.desktop"';' "${pkgname}/build-linux-64/newview/packaged/etc/refresh_desktop_app_entry.sh" mv "${pkgname}/build-linux-64/newview/packaged" "${pkgdir}/opt/${pkgname}" } diff --git a/compile.bash b/compile.bash new file mode 100755 index 000000000000..737f7d07cd83 --- /dev/null +++ b/compile.bash @@ -0,0 +1,55 @@ +#!/usr/bin/env bash +set -e +virtualenv ".venv" -p python3 +. ".venv/bin/activate" +echo "Installing autobuild..." +pip install --upgrade certifi --quiet +pip3 install --upgrade llbase --quiet +if command -v autobuild >/dev/null 2>&1 && [[ "$(autobuild --version)" == "autobuild 9.0.0" ]]; then + pip3 uninstall --yes autobuild --quiet +fi +pip3 install --no-cache --upgrade autobuild --quiet + +# we have a lot of files, relax ulimit to help performance +ulimit -n 20000 +build_jobs=$(nproc) +if [[ ${build_jobs} -gt 1 ]]; then + # The viewer requires an average of 4GB of memory per core to link + mempercorekb=$((4 * 1048576)) + requiredmemorykb=$(($(nproc) * mempercorekb)) + # Source: Total Used Free + free_output="$(free --kilo --total | tr -s ' ')" + totalmemorykb=$(grep Total <<< "$free_output" | cut -d ' ' -f 2) + freememorykb=$(grep Total <<< "$free_output" | cut -d ' ' -f 4) + #echo "Total memory: $totalmemorykb (includes swap)" + #echo "Free memory: $freememorykb" + #echo "Required memory: $requiredmemorykb" + if [[ ${requiredmemorykb} -gt ${totalmemorykb} ]]; then + echo "Not enough physical memory to build with all cores, adjusting" + echo "Estimated required memory to build with all cores: $((requiredmemorykb/1024/1024)) GB" + if [[ ${requiredmemorykb} -gt ${freememorykb} ]]; then + jobs=1 + echo "Allocating build jobs according to available memory (${freememorykb}/${requiredmemorykb})..." + while [[ $((jobs * mempercorekb)) -lt ${freememorykb} ]]; do + jobs=$((jobs+1)) + echo -e "${jobs}...$(((jobs * mempercorekb)/1024/1024))GB" + done + build_jobs=${jobs} + fi + fi +fi +if pacman -Qq ccache &> /dev/null; then + export PATH="/usr/lib/ccache/bin/:$PATH" + export CCACHE_SLOPPINESS="file_macro,locale,time_macros" + export CCACHE_NOHASHDIR="true" +fi +export AUTOBUILD_CPU_COUNT=$build_jobs +schedtool -B -n 1 -e ionice -n 1 autobuild configure -A 64 -c ReleaseOS -- \ + -DLL_TESTS:BOOL=OFF \ + -DDISABLE_FATAL_WARNINGS=ON \ + -DUSE_LTO:BOOL=OFF \ + -DDCMAKE_CXX_FLAGS="-march=x86-64-v2 -mtune=native" \ + -DVIEWER_CHANNEL="Alchemy Test" + +echo "Building with ${AUTOBUILD_CPU_COUNT} jobs (adjusted)" +schedtool -B -n 1 -e ionice -n 1 autobuild build -A64 -c ReleaseOS --no-configure |