summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorKevin Brodsky2020-01-11 16:06:54 +0000
committerKevin Brodsky2020-01-11 16:30:23 +0000
commit776257a166a7195326f050094f488ff42c6e02ef (patch)
tree6575dc1137f993df75d57d5da4b25d0c61207dd8 /PKGBUILD
parent9fa07074d8e8366ad5cdcff2e403ffe432208cc0 (diff)
downloadaur-776257a166a7195326f050094f488ff42c6e02ef.tar.gz
upgpkg: 0.94.2-2 (big refactor)
The latest update to libwebp (1.1) broke XnView, because it tries to link against the system libwebpmux.so while using the packaged libwebp.so (in Plugins). Because of this, I realised that there is no point in using the packaged plugins, since they are all libraries available in standard Arch packages. This commit replaces them with symlinks to system libs (as XnView is still unhappy if it cannot find them in Plugins/), and adds the relevant dependencies. While at it, I also realised that a lot of files are junk and don't need to be installed, and that many permissions are wrong. Fix all that by specifying which files/directories to install (instead of removing some), and only making executable those that should be. Finally, it looks the bug that prevented me from getting rid of lib/ altogether is gone, so there's no need to symlink the Qt plugin directories any more. As a result, the only use we still have for xnview.sh is the LD_PRELOAD hack, and we don't need the one included in the archive any more.
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD96
1 files changed, 63 insertions, 33 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 505dcf9d1db1..21ea71eebd99 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,25 +4,58 @@ pkgname=xnviewmp-system-libs
_pkgname=xnviewmp
pkgver=0.94.2
srcrel=1 # Incremented when there is a new release for the same version number
-pkgrel=1
+pkgrel=2
pkgdesc="An efficient multimedia viewer, browser and converter (using system libraries)."
url="http://www.xnview.com/en/xnviewmp/"
arch=('x86_64')
license=('custom')
-depends=('qt5-multimedia' 'qt5-svg' 'qt5-webkit' 'qt5-x11extras' 'qtav' 'desktop-file-utils')
+depends=(
+ # Main Qt dependencies
+ 'qt5-multimedia' 'qt5-svg' 'qt5-webkit' 'qt5-x11extras'
+ # Needed since 0.91: https://newsgroup.xnview.com/viewtopic.php?f=82&t=37907
+ 'qtav'
+ # Plugin libs
+ 'libwebp' 'openjpeg2' 'openexr'
+)
optdepends=('glib2: support for moving files to trash')
conflicts=('xnviewmp')
source=("XnViewMP-linux-x64_${pkgver}-rel${srcrel}.tgz::http://download.xnview.com/XnViewMP-linux-x64.tgz"
+ 'xnview.sh'
'xnviewmp.desktop'
'qt5_std_fun_forwarder.S'
'qt5_std_fun_forwarder.lds')
md5sums=('d6b931db8cf42aefe770581afb0184ad'
+ '54c5ea6508625ad44a23b9a204799264'
'24f44d5a881b94daf48775213a57e4ec'
'df94e031306ac22f7f19d38bf3023c1a'
'7fc3b01ef6eb321c5ecba75099e08d33')
+# There is a lot of useless files in the archive, only install those from that
+# list.
+installed_files_dirs=(
+ AddOn
+ country.txt
+ default.bar
+ default.keys
+ language
+ license.txt
+ PrintPresets.txt
+ ResizePresets.txt
+ UI
+ WhatsNew.txt
+ XnView
+ xnview_2.png
+ XnView.db
+ xnview.png
+)
+
+executable_files=(
+ AddOn/exiftool
+ XnView
+)
+
build() {
# This is massive hack to work around an incompatibility with the system Qt5
# libraries. Starting with 0.93.1, the dynamic linker fails to start XnView,
@@ -41,45 +74,42 @@ build() {
gcc -fPIC -shared -lstdc++ \
-Wl,--version-script="${srcdir}/qt5_std_fun_forwarder.lds" \
-o "${srcdir}/qt5_std_fun_forwarder.so" \
- "${srcdir}/qt5_std_fun_forwarder.S"
+ "${srcdir}/qt5_std_fun_forwarder.S"
}
package() {
- install -d -m755 "${pkgdir}/opt/${_pkgname}"
- install -d -m755 "${pkgdir}/usr/bin"
- install -d -m755 "${pkgdir}/usr/share/applications"
+ cd "${srcdir}/XnView"
- cp -a "${srcdir}/XnView"/* "${pkgdir}/opt/${_pkgname}"
- ln -s "/opt/${_pkgname}/xnview.sh" "${pkgdir}/usr/bin/${_pkgname}"
+ local pkg_opt_dir=${pkgdir}/opt/${_pkgname}
- install -m644 "${srcdir}/${_pkgname}.desktop" "${pkgdir}/usr/share/applications/${_pkgname}.desktop"
- install -D -m644 "${srcdir}/XnView/license.txt" "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"
+ install -d -m755 "${pkg_opt_dir}"
+ # The permissions set in the archive are unreliable and excessive (too many
+ # executable files). Instead of copying them, we chmod the files that
+ # actually need to be executable.
+ cp -r --no-preserve=mode "${installed_files_dirs[@]}" "${pkg_opt_dir}"
+ for file in "${executable_files[@]}"; do
+ chmod a+x "${pkg_opt_dir}/${file}"
+ done
- # Clean up
- rm "${pkgdir}/opt/${_pkgname}/XnView.desktop"
- chmod 644 "${pkgdir}/opt/${_pkgname}"/xnview*.png
- chmod 755 "${pkgdir}/opt/${_pkgname}/XnView"
+ # The plugin libs that XnView packages are included as dependencies, but
+ # XnView will only look for them in the Plugins directory (regardless of the
+ # linker paths). Create symlinks as needed.
+ install -d -m755 "${pkg_opt_dir}/Plugins"
+ ln -s /usr/lib/libwebp.so "${pkg_opt_dir}/Plugins/libwebp.so"
+ ln -s /usr/lib/libIlmImf.so "${pkg_opt_dir}/Plugins/IlmImf.so"
+ ln -s /usr/lib/libopenjp2.so "${pkg_opt_dir}/Plugins/openjp2.so"
- # Remove the bundled framework libs (Qt and icu).
- rm "${pkgdir}/opt/${_pkgname}/lib/"lib*
- # Since we are using system Qt libraries, we should also use the system Qt
- # plugins. Unfortunately using the system path doesn't quite work because of a
- # bug when Qt's loader tries to use libqxcb-egl-integration.so, which is
- # not provided by XnView.
- # As a workaround, remove the provided plugin directories and symlink the
- # system ones instead.
- local dir
- for dir in "${pkgdir}/opt/${_pkgname}/lib/"*; do
- rm -r "${dir}"
- ln -s "/usr/lib/qt/plugins/$(basename "${dir}")" "${dir}"
- done
+ install -m755 "${srcdir}/xnview.sh" "${pkg_opt_dir}"
+
+ # Install our "function forwarder library" (see build()). xnview.sh forces the
+ # dynamic linker to use it by adding it to LD_PRELOAD.
+ install -D -m644 "${srcdir}/qt5_std_fun_forwarder.so" -t "${pkg_opt_dir}/lib"
+
+ install -d -m755 "${pkgdir}/usr/bin"
+ ln -s "/opt/${_pkgname}/xnview.sh" "${pkgdir}/usr/bin/${_pkgname}"
- # Install our "function forwarder library" (see build()) and force the dynamic
- # linker to use it by adding to LD_PRELOAD.
- install -m644 "${srcdir}/qt5_std_fun_forwarder.so" "${pkgdir}/opt/${_pkgname}/lib"
- sed -i '/exec/ i \
-export LD_PRELOAD="$dirname/lib/qt5_std_fun_forwarder.so:$LD_PRELOAD"' \
- "${pkgdir}/opt/${_pkgname}/xnview.sh"
+ install -D -m644 "${srcdir}/${_pkgname}.desktop" -t "${pkgdir}/usr/share/applications/"
+ install -D -m644 "${srcdir}/XnView/license.txt" "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"
}
# vim:set ts=2 sw=2 et: