summaryrefslogtreecommitdiff
blob: 2a466a91844e279b956c76db21e5c3a2d326fbe8 (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
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gnustep.eclass,v 1.8 2004/06/25 00:39:48 vapier Exp $

ECLASS=gnustep
INHERITED="$INHERITED $ECLASS"

DESCRIPTION="Based on the gnustep eclass."

DEPEND="dev-util/gnustep-make
	dev-util/gnustep-base
	sys-devel/gcc
	virtual/glibc"
RDEPEND="virtual/glibc"

getsourcedir() {
	if [ ! -d "${S}" ] ; then
		if [ -d "${WORKDIR}/${PN}" ] ; then
			S="${WORKDIR}/${PN}"
		elif [ -d "${WORKDIR}/${P}" ] ; then
			S="${WORKDIR}/${P}"
		else
			die "Cannot find source directory!"
		fi
	fi
}

need-gnustep-gui() {
	if [ "$1" ] ; then
		DEPEND="${DEPEND} >=dev-util/gnustep-gui-$1"
		RDEPEND="${RDEPEND} >=dev-util/gnustep-back-$1"
	else
		DEPEND="${DEPEND} dev-util/gnustep-gui"
		RDEPEND="${RDEPEND} dev-util/gnustep-back"
	fi
}

egnustepmake() {
	getsourcedir

	addwrite /root/GNUstep/Defaults/.GNUstepDefaults.lck
	addpredict /root/GNUstep	

	cd ${S}

	unset CFLAGS
	unset CC

	if [ -f /usr/GNUstep/System/Makefiles/GNUstep.sh ] ; then
		. /usr/GNUstep/System/Makefiles/GNUstep.sh
	else
		die "gnustep-make not installed!"
	fi

	mkdir -p $TMP/fakehome/GNUstep

	if [ -x configure ] ; then
		if [ -z "$*" ] ; then
			./configure \
				HOME=$TMP/fakehome \
				GNUSTEP_USER_ROOT=$TMP/fakehome/GNUstep \
				|| die "configure failed"
		else
			./configure \
				HOME=$TMP/fakehome \
				GNUSTEP_USER_ROOT=$TMP/fakehome/GNUstep \
				$* || die "configure failed (options: $*)"
		fi
	fi

	if [ "${GNUSTEPBACK_XFT}" != "2" ] ; then
		if [ "${PN}" = "gnustep-back" ] ; then
			if [ ! -f "/usr/X11R6/include/X11/Xft1/Xft.h" ]; then
				sed "s,^#define HAVE_XFT.*,#undef HAVE_XFT,g" config.h > config.h.new
				sed "s,^#define HAVE_UTF8.*,#undef HAVE_UTF8,g" config.h.new > config.h
				sed "s,^WITH_XFT=.*,WITH_XFT=no," config.make > config.make.new
				sed "s,-lXft,," config.make.new > config.make
			fi
		fi
	fi
	
	if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then
		make \
			HOME=$TMP/fakehome \
			GNUSTEP_USER_ROOT=$TMP/fakehome/GNUstep \
			|| die "emake failed"
	else
		die "no Makefile found"
	fi
	return 0
}

egnustepinstall() {
	getsourcedir

	addwrite /root/GNUstep/Defaults/.GNUstepDefaults.lck
	addpredict /root/GNUstep	

	cd ${S}
	
	if [ -f /usr/GNUstep/System/Makefiles/GNUstep.sh ] ; then
                source /usr/GNUstep/System/Makefiles/GNUstep.sh
        else
                die "gnustep-make not installed!"
        fi

	mkdir -p $TMP/fakehome/GNUstep

	if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then
		# To be or not to be evil?
		# Should all the roots point at GNUSTEP_SYSTEM_ROOT to force
		# install?
		# GNUSTEP_USER_ROOT must be GNUSTEP_SYSTEM_ROOT, some malformed
		# Makefiles install there. 
		if [ "${PN}" = "gnustep-base" ] || [ "${PN}" = "gnustep-gui" ] || [ "${PN}" = "gnustep-back" ] ; then
			# for some reason, they need less tending to...
			make \
				GNUSTEP_USER_ROOT=$TMP/fakehome/GNUstep \
				HOME=$TMP/fakehome \
				GNUSTEP_INSTALLATION_DIR=${D}${GNUSTEP_SYSTEM_ROOT} \
				INSTALL_ROOT_DIR=${D} \
				install || die "einstall failed"
		else 
			make \
				GNUSTEP_USER_ROOT=$TMP/fakehome/GNUstep \
				HOME=$TMP/fakehome \
        	        	GNUSTEP_INSTALLATION_DIR=${D}${GNUSTEP_SYSTEM_ROOT} \
                		INSTALL_ROOT_DIR=${D} \
				GNUSTEP_LOCAL_ROOT=${D}${GNUSTEP_LOCAL_ROOT} \
				GNUSTEP_NETWORK_ROOT=${D}${GNUSTEP_NETWORK_ROOT} \
				GNUSTEP_SYSTEM_ROOT=${D}${GNUSTEP_SYSTEM_ROOT} \
				GNUSTEP_USER_ROOT=${D}${GNUSTEP_SYSTEM_ROOT} \
		 		install || die "einstall failed"
		fi
	else
		die "no Makefile found" 
	fi
	return 0
}

gnustep_src_compile() {
	egnustepmake || die
}

gnustep_src_install() {
	egnustepinstall || die
}

EXPORT_FUNCTIONS src_compile src_install