aboutsummaryrefslogtreecommitdiff
path: root/srcpkgs/netpbm/template
blob: 7f05c9ac28a8ee751d3888614bae7c29060fe98e (plain) (blame)
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
# Template file for 'netpbm'
pkgname=netpbm
# from http://svn.code.sf.net/p/netpbm/code/advanced/doc/HISTORY
version=11.05.03
revision=1
_githash=19387d1be30e80e8c4e865bfe053aed1094ca8af
_githash_guide=6b76a2a4c4ca084113a87c1e7e8376609a722626
create_wrksrc=yes
build_wrksrc="netpbm-mirror-${_githash}"
hostmakedepends="flex perl pkg-config python3"
makedepends="libX11-devel libjpeg-turbo-devel libpng-devel libxml2-devel
 tiff-devel zlib-devel"
short_desc="Toolkit for manipulation of graphic images"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="BSD-3-Clause,GPL-2.0-only,custom:netpbm"
homepage="http://netpbm.sourceforge.net/"
distfiles="https://github.com/leahneukirchen/netpbm-mirror/archive/${_githash}.tar.gz
 https://github.com/leahneukirchen/netpbm-mirror/archive/${_githash_guide}.tar.gz"
checksum="3d098112c776f4bf23078ea08f6bc49f690f75abdf238eb65471657f5c874f78
 f846e4a226a35924fffe01050177fb4959a21020f9ac067687ede05424071a12"

post_extract() {
	cd $build_wrksrc
	for p in ${FILESDIR}/*.patch; do
		patch -Np1 -i $p
	done

	cd ../netpbm-mirror-${_githash_guide}
}

do_configure() {
	local endian bitsperlong
	cat config.mk.in ${FILESDIR}/config.mk >config.mk
	if [ "$XBPS_TARGET_MACHINE" = "i686" -o "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
		echo "WANT_SSE = Y" >>config.mk
	fi
	sed -i 's|misc|share/netpbm|' common.mk
	sed -i 's|/link|/lib|' lib/Makefile
	sed -i 's|/sharedlink|/lib|' lib/Makefile
	sed -i 's|install.manwebmain install.manweb install.man|install.man|' GNUmakefile
	if [ "$CROSS_BUILD" ]; then
		# Patch buildutils/endiangen.c to return the endianess
		# and word size for the target architecture
		# XXX: perhaps add XBPS_ENDIAN to common/cross-profiles/*.sh
		case "$XBPS_TARGET_MACHINE" in
			ppc|ppc-musl|ppc64|ppc64-musl) endian="ENDIAN_BIG";;
			*) endian="ENDIAN_LITTLE";;
		esac
		# XXX: perhaps add XBPS_BITSPERLONG to common/cross-files/*.sh
		case "$XBPS_TARGET_MACHINE" in
			aarch64*|x86_64*|ppc64*) bitsperlong="64";;
			*) bitsperlong="32";;
		esac
		vsed -i buildtools/endiangen.c \
			-e "s;byteOrder();$endian;" \
			-e "s;bitsPerLong();$bitsperlong;"
		# ... now build the tools for the host
		CC=$CC_host CFLAGS="$CFLAGS_host" \
		LD=$LD_host LDFLAGS="$LDFLAGS_host" \
			make -C buildtools
	fi
}

do_build() {
	make ${makejobs} CC=$CC CFLAGS="$CFLAGS" LDFLAGS_FOR_BUILD=
	make MAKEMAN="${PWD}/buildtools/makeman" USERGUIDE=. \
		-C ../netpbm-mirror-${_githash_guide} \
		-f "${PWD}/buildtools/manpage.mk" manpages
}

do_install() {
	make pkgdir=$DESTDIR/usr PKGMANDIR=share/man install-run install-dev
	vmkdir usr/share/man/man1
	vmkdir usr/share/man/man3
	vmkdir usr/share/man/man5
	make MAKEMAN="${PWD}/buildtools/makeman" MANDIR="$DESTDIR/usr/share/man" USERGUIDE=. \
		-C ../netpbm-mirror-${_githash_guide} \
		-f "${PWD}/buildtools/manpage.mk" installman
	vlicense doc/copyright_summary LICENSE
}

libnetpbm_package() {
	replaces="${sourcepkg}<10.66.03_2"
	short_desc+=" - runtime libraries"
	pkg_install() {
		vmove usr/lib/*.so.*
	}
}

libnetpbm-devel_package() {
	replaces="${sourcepkg}<10.66.03_2"
	depends="libnetpbm>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/*.so
	}
}