aboutsummaryrefslogtreecommitdiff
blob: 7d8e1745241c1b231aff0f356311712a8bd667bc (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=5

inherit autotools-multilib eutils flag-o-matic multilib toolchain-funcs

MY_V_SUFFIX="-8.5.2"

DESCRIPTION="Extension to Tk, adding new widgets, geometry managers, and misc commands"
HOMEPAGE="
	http://blt.sourceforge.net/
	http://jos.decoster.googlepages.com/bltfortk8.5.2"
SRC_URI="
	http://dev.gentoo.org/~jlec/distfiles/${PN}${PV}${MY_V_SUFFIX}.tar.gz
	http://jos.decoster.googlepages.com/${PN}${PV}${MY_V_SUFFIX}.tar.gz"

IUSE="jpeg static-libs X"
SLOT="0"
LICENSE="BSD"
KEYWORDS="~amd64"

DEPEND="
	dev-lang/tk[${MULTILIB_USEDEP}]
	jpeg? ( virtual/jpeg[${MULTILIB_USEDEP}] )
	X? ( x11-libs/libX11[${MULTILIB_USEDEP}] )"
RDEPEND="${DEPEND}"

S="${WORKDIR}/${PN}${PV}${MY_V_SUFFIX}"

AUTOTOOLS_AUTORECONF=yes
AUTOTOOLS_NO_AUTO_STATIC_LIBS_CONFARGS=yes
MULTILIB_WRAPPED_HEADERS=( usr/include/bltHash.h )
MULTILIB_PARALLEL_PHASES="src_configure src_compile"

src_prepare() {
	epatch "${FILESDIR}/blt-2.4z-r13-fix-makefile.patch"
	epatch "${FILESDIR}/blt-2.4z-r4-fix-makefile2.patch"
	# From blt-2.4z-6mdk.src.rpm
	epatch "${FILESDIR}"/blt2.4z-64bit.patch

	#epatch "${FILESDIR}"/blt-2.4z-tcl8.5-fix.patch
	epatch "${FILESDIR}"/blt-2.4z-tcl8.5-fixpkgruntime.patch

	epatch "${FILESDIR}"/${P}-ldflags-v2.patch

	# drop RPATH
	sed \
		-e 's:LD_RUN_PATH=.*$:LD_RUN_PATH="":g' \
		-i configure.in || die "sed configure.in failed"

	epatch \
		"${FILESDIR}"/${P}-linking.patch \
		"${FILESDIR}"/${P}-darwin.patch \
		"${FILESDIR}"/${P}-gbsd.patch \
		"${FILESDIR}"/${P}-tk8.6.patch \
		"${FILESDIR}"/${P}-tcl8.6.patch \
		"${FILESDIR}"/${P}-aclocal.patch \
		"${FILESDIR}"/${P}-deprecated-ac-output.patch \
		"${FILESDIR}"/${P}-gentoo-libdir.patch \
		"${FILESDIR}"/${P}-ar-withval.patch \
		"${FILESDIR}"/${P}-parallelmake.patch

	append-cflags -fPIC

	rm configure || die
	autotools-multilib_src_prepare
}

src_configure() {
	local RANLIB
	LC_ALL=C \
	autotools-multilib_src_configure \
		--x-includes="${EPREFIX}/usr/include" \
		--x-libraries="${EPREFIX}/usr/@GET_LIBDIR@" \
		--with-blt="${EPREFIX}/usr/@GET_LIBDIR@" \
		--with-tcl="${EPREFIX}/usr/@GET_LIBDIR@" \
		--with-tk="${EPREFIX}/usr/@GET_LIBDIR@" \
		--with-tclincls="${EPREFIX}/usr/include" \
		--with-tkincls="${EPREFIX}/usr/include" \
		--with-tcllibs="${EPREFIX}/usr/@GET_LIBDIR@" \
		--with-tklibs="${EPREFIX}/usr/@GET_LIBDIR@" \
		--with-gentoo-libdir="@GET_LIBDIR@" \
		--with-gnu-ld \
		$(use_enable jpeg) \
		$(use_with X x)
}

ehook autotools-utils-multilib-per-abi-pre_src_configure abi_pre_src_configure
abi_pre_src_configure() {
	myeconfargs+=(
		--with-cc="${CC:-$(tc-getCC)}"
		--with-ar="$(tc-getAR)"
		--with-cflags="${CFLAGS}"
	)
	tc-export RANLIB
	return 0
}

src_install() {
	sed \
		-e "s:\.\./src/bltwish:${EPREFIX}/usr/bin/bltwish:g" \
		-e "s:\.\./bltwish:${EPREFIX}/usr/bin/bltwish:g" \
		-e "s:/usr/local/bin/bltwish:${EPREFIX}/usr/bin/bltwish:g" \
		-e "s:/usr/local/bin/tclsh:${EPREFIX}/usr/bin/tclsh:g" \
		-i demos/{,scripts/}*.tcl || die

	dodir /usr/bin \
		/usr/share/man/mann \
		/usr/include

	autotools-multilib_src_install INSTALL_ROOT="${D}"

	dodoc NEWS PROBLEMS README
	dohtml html/*.html
	for f in `ls "${ED}"usr/share/man/mann` ; do
		mv "${ED}"usr/share/man/mann/${f} "${ED}"usr/share/man/mann/${f/.n/.nblt}
	done

	use static-libs || \
		find "${ED}"usr -name "*.a" -print0 | \
		xargs -r -0 rm -fv
}

ehook autotools-multilib-per-abi-pre_src_install abi_pre_src_install
abi_pre_src_install() {
	dodir /usr/$(get_libdir)/blt2.4/demos/bitmaps
	return 0
}

ehook autotools-multilib-per-abi-post_src_install abi_post_src_install
abi_post_src_install() {
	# fix for linking against shared lib with -lBLT or -lBLTlite
	dosym libBLT24$(get_libname) /usr/$(get_libdir)/libBLT$(get_libname)
	dosym libBLTlite24$(get_libname) /usr/$(get_libdir)/libBLTlite$(get_libname)

	# drop doc files from libdir
	rm -f ${ED}usr/$(get_libdir)/blt2.4/{NEWS,PROBLEMS,README} || die

	# remove demos from libdirs & install as doc
	if multilib_is_best_abi ; then
		docompress -x /usr/share/doc/${PF}/demos
		dodoc -r "${ED}"usr/$(get_libdir)/blt2.4/demos
	fi
	rm -r "${ED}"usr/$(get_libdir)/blt2.4/demos || die
}