1SUMMARY="Qt-based image viewer"
2DESCRIPTION="nomacs is a free, open source image viewer, which supports \
3multiple platforms. You can use it for viewing all common image formats \
4including RAW and psd images."
5HOMEPAGE="https://nomacs.org/"
6COPYRIGHT="2011-2020 Markus Diem
7	2011-2020 Stefan Fiel
8	2011-2020 Florian Kleber"
9LICENSE="GNU LGPL v3"
10REVISION="2"
11SOURCE_URI="https://github.com/nomacs/nomacs/archive/$portVersion.2282.tar.gz"
12CHECKSUM_SHA256="bf89d4c6072a7647af95edc161b2d5e45b7ce25aa256e48b655dcf37350433e4"
13SOURCE_FILENAME="nomacs-$portVersion.tar.gz"
14SOURCE_DIR="nomacs-$portVersion.2282"
15SOURCE_URI_2="https://github.com/nomacs/nomacs-plugins/archive/3.16.tar.gz"
16CHECKSUM_SHA256_2="ab6a91c582d48f4a4697d80ce549886921888cfbb32ea8b8c3b172fb7139225a"
17SOURCE_FILENAME_2="nomacs-plugins-$portVersion.tar.gz"
18SOURCE_DIR_2="nomacs-plugins-3.16"
19PATCHES="nomacs-$portVersion.patchset"
20ADDITIONAL_FILES="
21	nomacs.rdef.in
22	haikuicons.zip
23	"
24
25ARCHITECTURES="all !x86_gcc2"
26SECONDARY_ARCHITECTURES="x86"
27
28PROVIDES="
29	nomacs$secondaryArchSuffix = $portVersion
30	app:Nomacs$secondaryArchSuffix = $portVersion
31	"
32REQUIRES="
33	haiku$secondaryArchSuffix
34	lib:libexiv2$secondaryArchSuffix
35	lib:libexpat$secondaryArchSuffix
36	lib:libiconv$secondaryArchSuffix
37	lib:liblcms2$secondaryArchSuffix
38	lib:libopencv_core$secondaryArchSuffix
39	lib:libopencv_imgproc$secondaryArchSuffix
40	lib:libQt5Concurrent$secondaryArchSuffix
41	lib:libQt5Core$secondaryArchSuffix
42	lib:libQt5Gui$secondaryArchSuffix
43	lib:libQt5Network$secondaryArchSuffix
44	lib:libQt5PrintSupport$secondaryArchSuffix
45	lib:libQt5Svg$secondaryArchSuffix
46	lib:libQt5Widgets$secondaryArchSuffix
47	lib:libquazip1_qt5$secondaryArchSuffix
48	lib:libraw$secondaryArchSuffix
49	lib:libtiff$secondaryArchSuffix
50	lib:libz$secondaryArchSuffix
51	"
52
53BUILD_REQUIRES="
54	haiku${secondaryArchSuffix}_devel
55	devel:libexiv2$secondaryArchSuffix
56	devel:libexpat$secondaryArchSuffix
57	devel:libiconv$secondaryArchSuffix
58	devel:liblcms2$secondaryArchSuffix
59	devel:libopencv_core$secondaryArchSuffix
60	devel:libopencv_imgproc$secondaryArchSuffix
61	devel:libQt5Concurrent$secondaryArchSuffix
62	devel:libQt5Core$secondaryArchSuffix
63	devel:libQt5Gui$secondaryArchSuffix
64	devel:libQt5Network$secondaryArchSuffix
65	devel:libQt5PrintSupport$secondaryArchSuffix
66	devel:libQt5Svg$secondaryArchSuffix
67	devel:libQt5Widgets$secondaryArchSuffix
68	devel:libquazip1_qt5$secondaryArchSuffix
69	devel:libraw$secondaryArchSuffix
70	devel:libtiff$secondaryArchSuffix >= 5
71	devel:libz$secondaryArchSuffix
72	"
73BUILD_PREREQUIRES="
74	cmd:cmake
75	cmd:g++$secondaryArchSuffix
76	cmd:lcov
77	cmd:lrelease$secondaryArchSuffix
78	cmd:make
79	cmd:pkg_config$secondaryArchSuffix
80	cmd:unzip
81	"
82
83PATCH()
84{
85	unzip -o $sourceDir/../../additional-files/haikuicons.zip -d $sourceDir/ImageLounge/src/img
86	sed -e '/font-size:/d' -i $sourceDir/ImageLounge/src/stylesheet.css
87}
88
89BUILD()
90{
91	cd ImageLounge
92	mkdir -p plugins
93	cp -r $sourceDir2/* plugins
94
95	mkdir -p build
96	cd build
97
98	cmake .. \
99		-DCMAKE_BUILD_TYPE=Release \
100		-DUSE_SYSTEM_QUAZIP=ON \
101		-DENABLE_TRANSLATIONS=ON \
102		$cmakeDirArgs
103
104	make $jobArgs
105}
106
107INSTALL()
108{
109	cd ImageLounge/build
110	make install
111
112	local APP_SIGNATURE="application/x-vnd.nomacs"
113	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
114	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
115	local LONG_INFO="$SUMMARY"
116	sed \
117		-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
118		-e "s|@MAJOR@|$MAJOR|" \
119		-e "s|@MIDDLE@|$MIDDLE|" \
120		-e "s|@LONG_INFO@|$LONG_INFO|" \
121		$portDir/additional-files/nomacs.rdef.in > nomacs.rdef
122
123	mkdir -p $appsDir/Nomacs $manDir
124	mv $prefix/bin/nomacs $appsDir/Nomacs/Nomacs
125	mv $prefix/lib $appsDir/Nomacs
126	mv $appsDir/Nomacs/lib/nomacs-plugins $appsDir/Nomacs/plugins
127	mv $prefix/share/man/man1 $manDir
128	mv "$prefix/share/nomacs/Image Lounge/translations" $appsDir/Nomacs
129	rm -rf $prefix/bin $prefix/share
130
131	addResourcesToBinaries nomacs.rdef $appsDir/Nomacs/Nomacs
132	addAppDeskbarSymlink $appsDir/Nomacs/Nomacs
133}
134