summaryrefslogtreecommitdiff
blob: bbc6fd33fc694f2f73504d80ad547f75d4cab27e (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
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-util/cvsup/cvsup-16.1h.ebuild,v 1.6 2003/12/31 02:19:03 mr_bones_ Exp $

MY_P="${P/-/-snap-}"
EZM3="ezm3-1.1"
EZM3_TARGET="LINUXLIBC6"
EZM3_INSTALL="${S}/${EZM3}-install"	#// anywhere or having a trailing / makes the compile dies

DESCRIPTION="a faster alternative to cvs"
HOMEPAGE="http://www.cvsup.org/"
SRC_URI="ftp://ftp3.freebsd.org/pub/FreeBSD/development/CVSup/sources/${MY_P}.tar.gz
	ftp://ftp.freebsd.org/pub/FreeBSD/development/CVSup/ezm3/${EZM3}-src.tar.bz2
	ftp://ftp.freebsd.org/pub/FreeBSD/development/CVSup/ezm3/${EZM3}-${EZM3_TARGET}-boot.tar.bz2"

KEYWORDS="x86 ~ppc"
LICENSE="BSD"
SLOT="0"
IUSE="X opengl static"

DEPEND="virtual/glibc
	dev-util/yacc
	>=sys-apps/sed-4
	ppc? ( dev-lang/cm3 )"
RDEPEND="virtual/glibc"

S=${WORKDIR}

seduse() {
	[ -z "`use ${1}`" ] && echo "${2}" || echo ":"
}

src_unpack() {
	unpack ${A}
	[ ${ARCH} == "ppc" ] && epatch ${FILESDIR}/${PV}-ppc.patch
}

src_compile() {
	if [ ${ARCH} != "ppc" ] ; then
	########################
	### BEGIN EZM3 SETUP ###
	########################

	# when you do make, ezm3 builds & installs at the same time so we control
	# where it is going to install the compiler and stuff
	# (to not violate sandbox)
	cd ${S}/${EZM3}/m3config/src
	sed -i \
		-e "s:/usr/local:${EZM3_INSTALL}:" ${EZM3_TARGET} || \
			die "sed ${EZM3_TARGET} failed"
	echo "M3CC_MAKE = [\"make\", \"BISON=yacc\"]" >> ${EZM3_TARGET}

	# now we disable X and OpenGL if the user doesnt have them in their USE var
	sed -i \
		-e "s:/usr/local:${EZM3_INSTALL}:" \
	 	-e "s:touch:ranlib:" \
	 	-e "s:`seduse X 'import_X11():import_X11() is\nend\nproc dont_import_X11()'`:" \
		-e "s:`seduse opengl 'import_OpenGL():import_OpenGL() is\nend\nproc dont_import_OpenGL()'`:" \
			COMMON || \
				die "sed COMMON failed"

	# finally we compile the m3 compiler
	# we clear the CFLAGS because:
	#	(1) higher optimizations cause issues
	#	(2) it doesnt matter ... we arent installing the compiler ...
	# we clea the P because:
	#	newer build system uses this variable and having it breaks it
	cd ${S}/${EZM3}
	env -u CFLAGS -u P make || die "ezm3 compile failed"
	fi

	#########################
	### BEGIN CVSUP SETUP ###
	#########################

	# first we disable the gui (if no X) and enable static (if static is in USE)
	cd ${S}/${MY_P}
	local mym3flags=""
	use static	&&	mym3flags="${mym3flags} -DSTATIC"
	use X		||	mym3flags="${mym3flags} -DNOGUI"
	[ "${mym3flags:0:1}" == " " ] && mym3flags="${mym3flags:1}"
	sed -i \
		-e "s:/usr/local:${D}/usr:" \
	 	-e "s:^M3FLAGS=:M3FLAGS=${mym3flags}:" Makefile || \
			die "sed Makefile failed"

	# then we fix the /usr/local/etc/cvsup paths in all the files
	for f in `grep /usr/local/etc * -Rl` ; do
		sed -i \
			-e "s:/usr/local/etc:/etc:" ${f} || \
				die "sed ${f} failed"
	done

	# then we compile cvsup
	env PATH="${EZM3_INSTALL}/bin:${PATH}" make || die "cvsup compile failed"

	# now we do up the html pages ...
	cd ${S}/${MY_P}/doc
	make || die "html pages failed to compile !?"
	for f in `ls *.html` ; do
		sed -i \
			-e "s:images/::" ${f} || \
				die "sed ${f} failed"
	done
	mv ${S}/${MY_P}/doc/images/* ${S}/${MY_P}/doc/
}

src_install() {
	S="${S}/${MY_P}"

	for f in `find ${S} -perm +1 -type f | grep -v doc` ; do
		dobin ${f} || die "dobin failed (${f})"
	done

	doman ${S}/client/${EZM3_TARGET}/cvsup.1 \
		${S}/cvpasswd/${EZM3_TARGET}/cvpasswd.1 \
		${S}/server/${EZM3_TARGET}/cvsupd.8 || \
			die "doman failed"

	dohtml ${S}/doc/*.{html,gif} || die "dohtml failed"

	dodoc ${S}/{Acknowledgments,Announce,Blurb,ChangeLog,License,Install} || \
		die "dodoc failed"

	insinto /etc/cvsup
	doins ${FILESDIR}/gentoo.sup ${FILESDIR}/gentoo_mirror.sup || \
		die "doins failed"

	exeinto /etc/init.d
	newexe ${FILESDIR}/cvsupd.rc cvsupd || die "newexe failed"

	insinto /etc/conf.d
	newins ${FILESDIR}/cvsupd.confd cvsupd || die "newins failed"

	dodir /var/cvsup || die "dodir failed"
}