summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 559a0b21a7371c6cf44fa734076a72837a8c63d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Maintainer: Martin Rys <https://rys.rs/contact>
# Contributor: John Troxler <firstname dot lastname at gmail dot com>

# https://github.com/loot/libloot/issues/95
# Maybe add doxgen for /docs, but then we get the following error as `spdlog`` will be pulled:
#   /home/c0rn3j/AUR/loot/src/loot-0.23.1/src/gui/state/game/game.cpp:49:10: fatal error: spdlog/fmt/bundled/ranges.h: No such file or directory
#      49 | #include <spdlog/fmt/bundled/ranges.h>

# Things like OGDF are downloaded prebuilt, this needs to be fixed if we want to have a proper source package
# See cmake doc link below

# loot E: ELF files outside of a valid path ('opt/').
# loot E: Insecure RUNPATH '.' in file ('opt/loot/LOOT')
# loot E: Insecure RUNPATH '/opt/loot' in file ('opt/loot/LOOT')

pkgname=loot
# https://github.com/loot/loot/releases
pkgver=0.29.2
pkgrel=1
pkgdesc="A load order optimisation tool for Starfield, The Elder Scrolls (Morrowind and later) and Fallout (3 and later) games"
arch=('x86_64')
url="https://loot.github.io"
license=('GPL-3.0-only')
depends=(
	'fmt'
	'icu'
	'hicolor-icon-theme'
	'minizip-ng'
	#'minizip-git'
	'ogdf' # AUR
	'onetbb'
	'qt6-base'
	'libloot'
	'spdlog'
	'tomlplusplus'
	'zlib'
)
makedepends=(
	'boost'
	'boost-libs'
	'cbindgen'
	'cmake'
	#'git'
	'python'
	'rust'
	'svg_to_ico'
)
#optdepends=('vulkan-headers: Optional build dependency')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/${pkgname}/${pkgname}/archive/${pkgver}.tar.gz")
sha256sums=('8f92d614320f907e0ea51061cb701d6d4e6d75124c94ed0aa7654dce9a1d0468')

prepare() {
	cd "${pkgname}-${pkgver}"
}

build() {
	cd "${srcdir}/${pkgname}-${pkgver}"

	# Archive structure: https://github.com/loot/loot/issues/1990
	mkdir -p pkg/lib pkg/include
	cp /usr/lib/libloot.s* ./pkg/lib/
	cp -r /usr/include/loot ./pkg/include/
	tar -zcf "libloot.tar.gz" ./pkg/

	# https://github.com/loot/loot?tab=readme-ov-file#cmake-variables
	# TODO(Martin): Fix minizip, minizip-ng is not checked for
	#               and minizip does not have cmake files as they were added in 2025-02 for which there is no release
	# REQUIRE_FIND_PACKAGE definitions are there to prevent dependencies being gotten off network instead of system
	cmake -B build \
		-DCMAKE_REQUIRE_FIND_PACKAGE_libloot=ON \
		-DCMAKE_REQUIRE_FIND_PACKAGE_MINIZIP=OFF \
		-DCMAKE_REQUIRE_FIND_PACKAGE_tomlplusplus=ON \
		-DCMAKE_REQUIRE_FIND_PACKAGE_fmt=ON \
		-DCMAKE_REQUIRE_FIND_PACKAGE_spdlog=ON \
		-DCMAKE_REQUIRE_FIND_PACKAGE_OGDF=ON \
		-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE \
		-DCMAKE_INSTALL_RPATH="/opt/${pkgname}"
		#-DLIBLOOT_URL="${srcdir}/${pkgname}-${pkgver}/libloot.tar.gz" \
	cmake --build build

	# Build translations
	python scripts/po_to_mo.py
}

package() {
	_builddir="${srcdir}/${pkgname}-${pkgver}/build"

	install -Dm755 -t "${pkgdir}/opt/${pkgname}" "${_builddir}/LOOT"

	install -d "${pkgdir}/usr/bin"
	ln -s "/opt/${pkgname}/LOOT" "${pkgdir}/usr/bin"

	# Install the icon
	install -Dm644 "${_builddir}/../resources/icons/loot.svg" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/io.github.loot.loot.svg"
	# Install desktop entry
	install -Dm644 "${_builddir}/../resources/linux/io.github.loot.loot.desktop" "${pkgdir}/usr/share/applications/io.github.loot.loot.desktop"

	# Install translations
	# en directory has no translation file
	rm -rf ${_builddir}/../resources/l10n/en
	for dir in "${_builddir}/../resources/l10n/"*/; do
		install -Dm644 \
			"${dir}/LC_MESSAGES/"*.mo \
			-t "${pkgdir}/usr/share/locale/$(basename "${dir}")/LC_MESSAGES"
	done
}