summaryrefslogtreecommitdiff
blob: a912baa302975b1cf194b66b884b1b29a3431239 (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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/x11-libs/openmotif/openmotif-2.1.30-r8.ebuild,v 1.5 2005/03/02 17:01:34 lanius Exp $

inherit eutils flag-o-matic multilib

MY_P=${P}-4_MLI.src
S=${WORKDIR}/motif
DESCRIPTION="Open Motif (Metrolink Bug Fix Release)"
HOMEPAGE="http://www.openmotif.org/"
SRC_URI="ftp://ftp.metrolink.com/pub/openmotif/2.1.30-4/${MY_P}.tar.gz"

LICENSE="MOTIF"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
IUSE=""

PROVIDE="virtual/motif"

RDEPEND="virtual/libc
	virtual/x11
	x11-libs/motif-config"
DEPEND="${RDEPEND}
	>=sys-apps/sed-4"

SLOT="2.1"

pkg_setup() {
	# multilib includes don't work right in this package...
	[ -n "${ABI}" ] && append-flags "-I/usr/include/gentoo-multilib/${ABI}"
}

src_unpack() {
	local cfg="${S}/config/cf/site.def"

	unpack ${A}
	cd ${S}

	epatch ${FILESDIR}/${P}-CAN-2004-0687-0688.patch.bz2
	epatch ${FILESDIR}/${P}-CAN-2004-0914-newer.patch.bz2
	epatch ${FILESDIR}/${P}-CAN-2004-0914_sec8.patch
	epatch ${FILESDIR}/CAN-2005-0605.patch

	ebegin "adjusting file permissions"
	chmod -R ug+w .
	eend $? || die

	ebegin "setting up site.def"
	cp ${FILESDIR}/site.def ${S}/config/cf/site.def && \
	echo >>$cfg && \
	echo >>$cfg "#undef  OptimizedCDebugFlags" && \
	echo >>$cfg "#define OptimizedCDebugFlags ${CFLAGS}" && \
	echo >>$cfg "#undef  OptimizedCplusplusDebugFlags" && \
	echo >>$cfg "#define OptimizedCplusplusDebugFlags ${CXXFLAGS}" &&\
	echo >>$cfg "#undef  LinuxCLibMajorVersion" && \
	echo >>$cfg "#define  LinuxCLibMajorVersion 6"
	eend $? || die


	# move `system.mwmrc' from `lib/X11' to `lib/X11/mwm'
	ebegin "patching 'clients/mwm/Imakefile' (mwm confdir)"
	LC_ALL="C" sed -i \
	  -e 's:\(SpecialObjectRule.*WmResParse\.o.*/lib/X11\)\(.*\):\1/mwm\2:'\
	  -e 's:\(InstallNonExecFile.system\.mwmrc,\).*/lib/X11\(.*\):\1/etc/X11/mwm\2:'\
	    "${S}/clients/mwm/Imakefile"
	eend $? || die

	epatch ${FILESDIR}/${PN}-2.1.30-imake-tmpdir.patch
	# compile on gcc 2.9x
	epatch ${FILESDIR}/${PN}-2.1.30-imake-ansi.patch
	epatch ${FILESDIR}/${PN}-2.1.30-uil-bad_grammar_fix.diff
	use ppc-macos && epatch ${FILESDIR}/${PN}-2.1.30-darwin-netbsd.diff
}

src_compile() {
	# glibc-2.3.2-r1/gcc-3.2.3 /w `-mcpu=athlon-xp -O2', right-clicking
	# in nedit triggers DPMS monitor standby instead of popping up the 
	# context menu.  this doesn't happen on my `stable' test partition 
	# where everything is compiled i686, nor with most non-essential 
	# packages athlon-xp and only motif i686.  needs investigation.
	replace-flags "-mcpu=athlon-xp" "-mcpu=i686"

	# fails to copmile with -jx
	export MAKEOPTS="${MAKEOPTS} -j1"

	mkdir -p imports/x11
	cd imports/x11
	ln -s /usr/X11R6/bin bin
	ln -s /usr/X11R6/include include
	ln -s /usr/X11R6/lib lib
	cd ${S}
	make World || make World || die
}

src_install() {
	make DESTDIR=${D} VARDIR=${D}/var install || die "make install"
	make DESTDIR=${D} install.man || die "make install.man"

	# cleanups
	local NOINSTBIN="imake lndir makedepend makeg mergelib mkdirhier xmkmf"
	local NOINSTMAN1="imake lndir makedepend makeg mkdirhier xmkmf"

	rm -fR ${D}/etc
	for nib in ${NOINSTBIN}; do
		f="${D}/usr/X11R6/bin/${nib}"; rm "$f" || die "rm $f"
	done
	for nim in ${NOINSTMAN1}; do
		if useq ppc-macos ; then
			f="${D}/usr/X11R6/man/man1/${nim}.1"
		else
			f="${D}/usr/X11R6/man/man1/${nim}.1x"
		fi
		 rm "$f" || die "rm $f"
	done
	rm -rf "${D}/usr/X11R6/lib/X11" || die "rm config"
	rm -rf "${D}/usr/X11R6/include/X11" || die "rm config"
	rm -rf "${D}/usr/X11R6/lib/bindings" || die "rm bindings"

	dodir /usr/share/man
	mv ${D}/usr/X11R6/man/* ${D}/usr/share/man/
	dodir /usr/bin
	mv ${D}/usr/X11R6/bin/* ${D}/usr/bin/
	dodir /usr/include
	mv ${D}/usr/X11R6/include/* ${D}/usr/include/
	dodir /usr/$(get_libdir)
	mv ${D}/usr/X11R6/lib/* ${D}/usr/$(get_libdir)/
	rm -fR ${D}/usr/X11R6


	einfo "Fixing binaries"
	for file in `ls ${D}/usr/bin`
	do
		mv ${D}/usr/bin/${file} ${D}/usr/bin/${file}-openmotif-2.1
	done

	einfo "Fixing libraries"
	dodir /usr/$(get_libdir)/openmotif-2.1
	mv ${D}/usr/$(get_libdir)/* ${D}/usr/$(get_libdir)/openmotif-2.1/

	einfo "Fixing includes"
	dodir /usr/include/openmotif-2.1/
	mv ${D}/usr/include/* ${D}/usr/include/openmotif-2.1

	einfo "Fixing man pages"
	mans="1 3 5 7"
	for man in $mans; do
		dodir /usr/share/man/man${man}
		for file in `ls ${D}/usr/share/man/man${man}`
		do
			file=${file/.${man}x/}
			mv ${D}/usr/share/man/man$man/${file}.${man}x ${D}/usr/share/man/man${man}/${file}-openmotif-2.1.${man}
		done
	done

	dodoc README COPYRIGHT.MOTIF RELEASE RELNOTES
	dodoc BUGREPORT OPENBUGS CLOSEDBUGS
}

# Profile stuff
pkg_postinst() {
	motif-config --install openmotif-2.1
}

pkg_prerm() {
	motif-config --uninstall openmotif-2.1
}