summaryrefslogtreecommitdiff
blob: cb52a1c7a4c6dd0d4b9be8b8d02ff0be3bcb0510 (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
# Copyright 1999-2000 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# Author Dan Armak <danarmak@gentoo.org>
# $Header: /var/cvsroot/gentoo-x86/eclass/kde-child.eclass,v 1.2 2002/07/12 15:24:36 danarmak Exp $
# Inherited by children ebuilds, which must specify their $PARENT ebuild before inheriting.
ECLASS=kde-child
INHERITED="$INHERITED $ECLASS"
#TODO: prevent $S/README, etc. from being dodoc'd

# determine settings
# Rename to $SIBLINGS? :-)
[ -z "$SUBDIRS" ] && SUBDIRS="$PN doc"

if [ -z "$PARENT" ]; then
	einfo "!!! $ECLASS: error: kde-child sourced, but \$PARENT not defined. Please report this bug."
	exit 1
fi

debug-print "$ECLASS: beginning, PARENT=$PARENT, SUBDIRS=$SUBDIRS"

# source parent ebuild
debug-print "$ECLASS: sourcing ${PORTDIR}/${PARENT}"
source "/usr/portage/${PARENT}"

ECLASS=kde-child
DESCRIPTION="Based on the $ECLASS eclass"

# no master-side src_unpack mods allowed atm
kde-child_src_unpack () {

	base_src_unpack

	cd ${S}
	# convert spaces to newlines
	mv subdirs subdirs.orig
	for x in $SUBDIRS; do
		debug-print "$FUNCNAME: parsing \$SUBDIRS: adding $x to subdirs"
		echo $x >> subdirs
	done
	rm subdirs.orig

	# we always do this, but it won't take effect unless doc is in $SUBDIRS!
	if [ -d doc ]; then
		cd doc
		DOCSUBDIRS=""
		for x in $SUBDIRS; do
			[ -d "$x" ] && DOCSUBDIRS="$DOCSUBDIRS $x"
		done
		debug-print "$FUNCNAME: doc subdir detected, found DOCSUBDIRS=$DOCSUBDIRS"
		mv Makefile.am Makefile.am.orig
		sed -e "s:SUBDIRS = \$(AUTOSUBDIRS):SUBDIRS = $DOCSUBDIRS:" Makefile.am.orig > Makefile.am
		mv Makefile.in Makefile.in.orig
		sed -e "s:SUBDIRS =. :SUBDIRS =. $DOCSUBDIRS \#:" Makefile.in.orig > Makefile.in
		rm Makefile.in.orig Makefile.am.orig
	fi

	# if asked, enable non-default packages
	if [ -n "$FORCE" ]; then
		cd ${S}
		for x in $FORCE; do
			for y in configure configure.in; do
				mv $y $y.orig
				sed -e "s:DO_NOT_COMPILE=\"\$DO_NOT_COMPILE ${x}\":\#:" $y.orig > $y
				rm $y.orig
			done
		done
		chmod +x configure
	fi

	# Finally, delete all top-level subdirs except for those in $SUBDIRS
	# and admin and doc. This way we both save space and locate any
	# subdir interdependencies.
	cd ${S}
	for x in *
	do
		# process all directories
		if [ -d "$x" ]; then

			KEEP=false

			# check if $x is in $SUBDIRS, if it is we should keep it
			case "$SUBDIRS admin" in
				*$x*) KEEP=true;;
			esac

			# remove it if we decided not to keep it
			if [ "$KEEP" == "false" ]; then

				debug-print "$FUNCNAME: removing subdir $x"

				# make sure configure doesn't try to create makefiles in the 
				# directories we're removing
				echo "./admin/configure.in.min
configure.in.in" > configure.files
				find $x -iname configure.in.in >> configure.files

				# finally, remove it
				rm -rf $x
				rm -rf doc/$x

			else
				debug-print "$FUNCNAE: keeping subdir $x"
			fi

		fi
	done

}

EXPORT_FUNCTIONS src_unpack