| 1 |
# Copyright 1999-2009 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/net-libs/osptoolkit/osptoolkit-3.4.2.ebuild,v 1.1 2009/04/20 04:01:41 volkmar Exp $ |
| 4 |
|
| 5 |
EAPI="2" |
| 6 |
|
| 7 |
inherit eutils multilib toolchain-funcs |
| 8 |
|
| 9 |
S_DATE="20071227" |
| 10 |
|
| 11 |
DESCRIPTION="Open Settlement Protocol development kit" |
| 12 |
HOMEPAGE="http://www.transnexus.com/OSP%20Toolkit/OSP%20Toolkit%20Documents/OSP%20Toolkit%20Documents.htm" |
| 13 |
SRC_URI="mirror://sourceforge/osp-toolkit/OSPToolkit-${PV}.tar.gz |
| 14 |
mirror://sourceforge/osp-toolkit/${PN}_${PV}-1.diff.gz" |
| 15 |
|
| 16 |
LICENSE="BSD" |
| 17 |
SLOT="0" |
| 18 |
KEYWORDS="~x86" |
| 19 |
IUSE="" |
| 20 |
|
| 21 |
RDEPEND="dev-libs/openssl" |
| 22 |
DEPEND="${RDEPEND}" |
| 23 |
|
| 24 |
S="${WORKDIR}"/TK-${PV//./_}-${S_DATE} |
| 25 |
|
| 26 |
# TODO: |
| 27 |
# generate a shared lib |
| 28 |
|
| 29 |
# NOTES: |
| 30 |
# debian patch is used atm but will surely not for further versions |
| 31 |
# osptest isn't a test that can be used for src_test, it's part of the toolkit |
| 32 |
|
| 33 |
src_prepare() { |
| 34 |
# applying debian patches |
| 35 |
epatch "${WORKDIR}"/${PN}_${PV}-1.diff |
| 36 |
|
| 37 |
# change enroll path from debian paches |
| 38 |
sed -i -e "s:^\(ospdir\).*:\1=/usr/lib/${PN}:" \ |
| 39 |
bin/enroll.sh || die "patching bin/enroll.sh failed" |
| 40 |
|
| 41 |
# remove -O and use users CFLAGS, see bug 241034 |
| 42 |
sed -i -e "s/ -O//" -e "s/^CFLAGS =/CFLAGS +=/" src/Makefile test/Makefile \ |
| 43 |
enroll/Makefile || die "patching Makefiles failed" |
| 44 |
|
| 45 |
# use users LDFLAGS |
| 46 |
sed -i -e "s:LFLAGS:LDFLAGS:" test/Makefile \ |
| 47 |
|| die "patching test/Makefile failed" |
| 48 |
sed -i -e "s:\(\$(LIBS\):\$(LDFLAGS) \1:" enroll/Makefile \ |
| 49 |
|| die "patching enroll/Makefile failed" |
| 50 |
|
| 51 |
# change lib dir to $(get_libdir) |
| 52 |
sed -i -e "s:\$(INSTALL_PATH)/lib:\$(INSTALL_PATH)/$(get_libdir):" \ |
| 53 |
src/Makefile || die "patching src/Makefile failed" |
| 54 |
|
| 55 |
# test.cfg is located in /etc/${PN}/test.cfg |
| 56 |
sed -i -e \ |
| 57 |
"s:\(^#define CONFIG_FILENAME.*\"\).*\(test.cfg\"\):\1/etc/${PN}/\2:" \ |
| 58 |
test/test_app.c || die "patching test/test_app.c failed" |
| 59 |
|
| 60 |
# configure enroll.sh |
| 61 |
sed -i -e "s:^\(OPENSSL_CONF\).*:\1=/etc/ssl/openssl.cnf:" \ |
| 62 |
-e "s:^\(RANDFILE\).*:\1=\/etc/${PN}/.rnd:" \ |
| 63 |
bin/enroll.sh || die "patching bin/enroll.sh failed" |
| 64 |
} |
| 65 |
|
| 66 |
src_compile() { |
| 67 |
local my_cc=$(tc-getCC) |
| 68 |
|
| 69 |
emake -C src CC="${my_cc}" build || die "emake libosp failed" |
| 70 |
emake -C enroll CC="${my_cc}" linux || die "emake enroll failed" |
| 71 |
# line above doesn't build tests but osptest (see NOTES) |
| 72 |
emake -C test CC="${my_cc}" linux || die "emake test failed" |
| 73 |
} |
| 74 |
|
| 75 |
src_install() { |
| 76 |
local ospdir="/usr/$(get_libdir)/${PN}" |
| 77 |
|
| 78 |
emake -C src INSTALL_PATH="${D}"/usr install || die "emake install failed" |
| 79 |
|
| 80 |
insinto /etc/${PN} |
| 81 |
doins bin/test.cfg bin/.rnd || die "doins failed" |
| 82 |
|
| 83 |
# install enroll and enroll.sh in lib dir to prevent executing them |
| 84 |
dodir ${ospdir} |
| 85 |
exeinto ${ospdir} |
| 86 |
doexe bin/enroll bin/enroll.sh || die "doexe failed" |
| 87 |
|
| 88 |
# use the symlink to execute enroll.sh |
| 89 |
dosym ${ospdir}/enroll.sh /usr/bin/ospenroll || die "dosym failed" |
| 90 |
|
| 91 |
newbin bin/test_app osptest || die "newbin failed" |
| 92 |
|
| 93 |
dodoc README.txt RELNOTES.txt || die "dodoc failed" |
| 94 |
} |
| 95 |
|
| 96 |
pkg_postinst() { |
| 97 |
elog "OSP test application is now available with 'osptest' command" |
| 98 |
elog "OSP enroll application is now available with 'ospenroll' command" |
| 99 |
} |