[dev-libs/libtom{crypt,math}] convert to autotools-multilib, static-libs support is incomplete (i. e. not working)

This commit is contained in:
Robert Förster 2013-11-11 19:34:13 +01:00
parent 76c77d3e51
commit d68351f517
5 changed files with 224 additions and 37 deletions

View File

@ -1,37 +1,81 @@
--- a/makefile.shared 2009-03-16 11:07:19.000000000 +0100 --- makefile.shared.old 2013-11-11 19:07:58.870000000 +0100
+++ b/makefile.shared 2009-03-16 11:30:25.000000000 +0100 +++ makefile.shared 2013-11-11 19:09:02.790000000 +0100
@@ -9,7 +9,7 @@ @@ -9,7 +9,8 @@
VERSION=0:117 VERSION=0:117
# Compiler and Linker Names # Compiler and Linker Names
-CC=libtool --mode=compile --tag=CC gcc -CC=libtool --mode=compile --tag=CC gcc
+CC=libtool --mode=compile --tag CC gcc +LT ?= libtool
+LTCOMPILE = $(LT) --mode=compile --tag=CC $(CC)
# ranlib tools # ranlib tools
ifndef RANLIB ifndef RANLIB
@@ -244,7 +244,7 @@ @@ -229,9 +230,12 @@
#The default rule for make builds the libtomcrypt library.
default:library
+%.lo: %.c
+ $(LTCOMPILE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
+
#ciphers come in two flavours... enc+dec and enc
-src/ciphers/aes/aes_enc.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
- $(CC) $(CFLAGS) -DENCRYPT_ONLY -c src/ciphers/aes/aes.c -o src/ciphers/aes/aes_enc.o
+src/ciphers/aes/aes_enc.lo: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
+ $(LTCOMPILE) $(CFLAGS) -DENCRYPT_ONLY -c src/ciphers/aes/aes.c -o src/ciphers/aes/aes_enc.o
#These are the rules to make certain object files.
src/ciphers/aes/aes.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
@@ -244,38 +248,38 @@
library: $(LIBNAME) library: $(LIBNAME)
testprof/$(LIBTEST): testprof/$(LIBTEST):
- cd testprof ; CFLAGS="$(CFLAGS)" GROUP=$(GROUP) USER=$(USER) VERSION=$(VERSION) LIBPATH=$(LIBPATH) LIBTEST=$(LIBTEST) LIBTEST_S=$(LIBTEST_S) make -f makefile.shared - cd testprof ; CFLAGS="$(CFLAGS)" GROUP=$(GROUP) USER=$(USER) VERSION=$(VERSION) LIBPATH=$(LIBPATH) LIBTEST=$(LIBTEST) LIBTEST_S=$(LIBTEST_S) make -f makefile.shared
+ cd testprof ; CFLAGS="$(CFLAGS)" GROUP=$(GROUP) USER=$(USER) VERSION=$(VERSION) LIBPATH=$(LIBPATH) LIBTEST=$(LIBTEST) LIBTEST_S=$(LIBTEST_S) $(MAKE) -f makefile.shared + cd testprof ; CFLAGS="$(CFLAGS)" VERSION=$(VERSION) LIBPATH=$(LIBPATH) LIBTEST=$(LIBTEST) LIBTEST_S=$(LIBTEST_S) make -f makefile.shared
objs: $(OBJECTS) objs: $(OBJECTS)
@@ -253,7 +253,7 @@ -$(LIBNAME): $(OBJECTS) testprof/$(LIBTEST)
- libtool --silent --mode=link gcc $(CFLAGS) `find . -type f | grep "[.]lo" | grep "src/" | xargs` $(EXTRALIBS) -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION)
+$(LIBNAME): $(OBJECTS:.o=.lo) testprof/$(LIBTEST:.o=.lo)
+ libtool --silent --mode=link --tag CC $(CC) $(CFLAGS) `find . -type f | grep "[.]lo" | grep "src/" | xargs` $(EXTRALIBS) -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION)
install: $(LIBNAME) install: $(LIBNAME)
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH) - install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH)
- cd testprof ; CFLAGS="$(CFLAGS)" GROUP=$(GROUP) USER=$(USER) VERSION=$(VERSION) LIBPATH=$(LIBPATH) LIBTEST=$(LIBTEST) LIBTEST_S=$(LIBTEST_S) DESTDIR=$(DESTDIR) make -f makefile.shared install - cd testprof ; CFLAGS="$(CFLAGS)" GROUP=$(GROUP) USER=$(USER) VERSION=$(VERSION) LIBPATH=$(LIBPATH) LIBTEST=$(LIBTEST) LIBTEST_S=$(LIBTEST_S) DESTDIR=$(DESTDIR) make -f makefile.shared install
+ cd testprof ; CFLAGS="$(CFLAGS)" GROUP=$(GROUP) USER=$(USER) VERSION=$(VERSION) LIBPATH=$(LIBPATH) LIBTEST=$(LIBTEST) LIBTEST_S=$(LIBTEST_S) DESTDIR=$(DESTDIR) $(MAKE) -f makefile.shared install - libtool --silent --mode=install install -c libtomcrypt.la $(DESTDIR)$(LIBPATH)/libtomcrypt.la
libtool --silent --mode=install install -c libtomcrypt.la $(DESTDIR)$(LIBPATH)/libtomcrypt.la - install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(INCPATH)
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(INCPATH) - install -g $(GROUP) -o $(USER) $(HEADERS) $(DESTDIR)$(INCPATH)
install -g $(GROUP) -o $(USER) $(HEADERS) $(DESTDIR)$(INCPATH) + install -d $(DESTDIR)$(LIBPATH)
--- a/testprof/makefile.shared 2009-03-16 11:26:19.000000000 +0100 + cd testprof ; CFLAGS="$(CFLAGS)" VERSION=$(VERSION) LIBPATH=$(LIBPATH) LIBTEST=$(LIBTEST) LIBTEST_S=$(LIBTEST_S) DESTDIR=$(DESTDIR) make -f makefile.shared install
+++ b/testprof/makefile.shared 2009-03-16 11:26:47.000000000 +0100 + $(LT) --mode=install install -c libtomcrypt.la $(DESTDIR)$(LIBPATH)/libtomcrypt.la
@@ -1,4 +1,4 @@ + install -d $(DESTDIR)$(INCPATH)
-CC=libtool --mode=compile gcc + install -m 644 $(HEADERS) $(DESTDIR)$(INCPATH)
+CC=libtool --mode=compile --tag CC gcc
CFLAGS += -I../src/headers -I./ -Wall -W #This rule makes the hash program included with libtomcrypt
hashsum: library
- gcc $(CFLAGS) demos/hashsum.c -o hashsum.o
- gcc -o hashsum hashsum.o -ltomcrypt $(EXTRALIBS)
+ $(CC) $(CFLAGS) demos/hashsum.c -o hashsum.o
+ $(CC) -o hashsum hashsum.o -ltomcrypt $(EXTRALIBS)
#makes the crypt program
crypt: library
- gcc $(CFLAGS) demos/encrypt.c -o encrypt.o
- gcc -o crypt encrypt.o -ltomcrypt $(EXTRALIBS)
+ $(CC) $(CFLAGS) demos/encrypt.c -o encrypt.o
+ $(CC) -o crypt encrypt.o -ltomcrypt $(EXTRALIBS)
tv_gen: library $(TVS)
- gcc -o tv_gen $(TVS) -ltomcrypt $(EXTRALIBS)
+ $(CC) -o tv_gen $(TVS) -ltomcrypt $(EXTRALIBS)
test: library testprof/$(LIBTEST) $(TESTS)
- gcc -o $(TEST) $(TESTS) -ltomcrypt_prof -ltomcrypt $(EXTRALIBS)
+ $(CC) -o $(TEST) $(TESTS) -ltomcrypt_prof -ltomcrypt $(EXTRALIBS)
timing: library testprof/$(LIBTEST) $(TIMINGS)
- gcc -o $(TIMING) $(TIMINGS) -ltomcrypt_prof -ltomcrypt $(EXTRALIBS)
+ $(CC) -o $(TIMING) $(TIMINGS) -ltomcrypt_prof -ltomcrypt $(EXTRALIBS)
# $Source: /cvs/libtom/libtomcrypt/makefile.shared,v $
# $Revision: 1.80 $

View File

@ -1,10 +1,10 @@
# Copyright 1999-2012 Gentoo Foundation # Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-libs/libtomcrypt/libtomcrypt-1.17-r6.ebuild,v 1.2 2012/02/25 15:22:17 jer Exp $ # $Header: $Id$
EAPI="2" EAPI="5"
inherit flag-o-matic multilib toolchain-funcs inherit autotools-multilib eutils flag-o-matic multilib toolchain-funcs
DESCRIPTION="modular and portable cryptographic toolkit" DESCRIPTION="modular and portable cryptographic toolkit"
HOMEPAGE="http://libtom.org/?page=features&whatfile=crypt" HOMEPAGE="http://libtom.org/?page=features&whatfile=crypt"
@ -13,9 +13,9 @@ SRC_URI="http://libtom.org/files/crypt-${PV}.tar.bz2"
LICENSE="WTFPL-2" LICENSE="WTFPL-2"
SLOT="0" SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86" KEYWORDS="~amd64 ~ppc ~x86"
IUSE="doc" IUSE="doc static-libs"
RDEPEND="dev-libs/libtommath" RDEPEND="dev-libs/libtommath[static-libs?,${MULTILIB_USEDEP}]"
DEPEND="${RDEPEND} DEPEND="${RDEPEND}
doc? ( virtual/latex-base app-text/ghostscript-gpl )" doc? ( virtual/latex-base app-text/ghostscript-gpl )"
@ -28,16 +28,34 @@ src_prepare() {
-e "s:src/pk/rsa/rsa_verify_hash.o :src/pk/rsa/rsa_verify_hash.o src/pk/rsa/rsa_verify_simple.o :g" \ -e "s:src/pk/rsa/rsa_verify_hash.o :src/pk/rsa/rsa_verify_hash.o src/pk/rsa/rsa_verify_simple.o :g" \
{,testprof/}makefile.shared || die {,testprof/}makefile.shared || die
cp "${FILESDIR}/rsa_verify_simple.c" "${S}/src/pk/rsa" cp "${FILESDIR}/rsa_verify_simple.c" "${S}/src/pk/rsa"
# need libtool for cross compilation. Bug #376643
cat <<-EOF > configure.ac
AC_INIT(libtomcrypt, 0)
AM_INIT_AUTOMAKE
LT_INIT
AC_CONFIG_FILES(Makefile)
AC_OUTPUT
EOF
touch NEWS README AUTHORS ChangeLog Makefile.am
eautoreconf
# export LT="${S}"/libtool
multilib_copy_sources
}
_emake() {
cd ${BUILD_DIR}
emake CC="$(tc-getCC)" -f makefile.shared \
EXTRALIBS="-ltommath" \
IGNORE_SPEED=1 \
LIBPATH="${EPREFIX}/usr/$(get_libdir)" \
INCPATH="${EPREFIX}/usr/include" \
"$@"
} }
src_compile() { src_compile() {
append-flags -DLTM_DESC append-cflags -DLTM_DESC
export LIBPATH="/usr/$(get_libdir)" multilib_foreach_abi _emake
EXTRALIBS="-ltommath" \
CC=$(tc-getCC) \
IGNORE_SPEED=1 \
emake -f makefile.shared \
|| die "emake failed"
} }
src_test() { src_test() {
@ -46,12 +64,11 @@ src_test() {
} }
src_install() { src_install() {
emake -f makefile.shared DESTDIR="${D}" install ||\ multilib_foreach_abi _emake DESTDIR="${ED}" install
die "emake install failed" dodoc TODO changes
dodoc TODO changes || die "dodoc failed"
if use doc ; then if use doc ; then
dodoc doc/* || die "dodoc failed" dodoc doc/*
docinto notes ; dodoc notes/* || die "dodoc failed" docinto notes ; dodoc notes/*
docinto demos ; dodoc demos/* || die "dodoc failed" docinto demos ; dodoc demos/*
fi fi
} }

View File

@ -0,0 +1,15 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
AUX libtommath-0.42.0-makefile.patch 1694 SHA256 de23b0b66ed4f51d0831bb4b1e7affd06e5adcee9b83dccf5144c2a40491d8bc SHA512 3ba5253df119d57e598167d4ea0c3cbc000c50395598a953462d24e21832d41bdb16631688a99266f533e133fa39a58cc271e32d05e61b3756697ddb06898999 WHIRLPOOL cf79bc2234f5aa9e831024588d671510a36f3ac50c461f590a006eb60491baffff4b46a30154cb56ea3e2c2e3eee548e075fc16911f26e1a4739a3527d2f78f7
DIST ltm-0.42.0.tar.bz2 1968961 SHA256 7b5c258304c34ac5901cfddb9f809b9b3b8ac7d04f700cf006ac766a923eb217 SHA512 c5bb26a260477de4e9abee9f65735754efa69c39c89caa3a06dd8ad3eda9d27fff687a432e91e3410b2bcc6a9e3d59921b6cdf6ca7f1ca6c69ed199a002e5790 WHIRLPOOL dd9879213b64d64f70620f98edfd027565a9cdf68dea03e427b0c1055f58347aa2ce9ad6f29b854b6aa50631e68bef29adc882d9db28cc73cb033ea6f3cae98f
EBUILD libtommath-0.42.0-r1.ebuild 1541 SHA256 99810bc599a314089cc1f78115a3e57166e1b5c7af599399c733e22bcdbfa7d1 SHA512 0250add0fc594788e3629ad7678270287476d0746a3265c9a0cafa1cc07c07b7820e620c3a05054389a666977121ce7e700fc1ebb975b5b377041b3c9d0ea9ad WHIRLPOOL df1e048965cc96664654c94bf963de18465689c3484032a8f5d17e635c59a0c0eba12cda54bd814f15744227ba84441e9472dcaadfc9df85280db4600f5bd187
MISC ChangeLog 8737 SHA256 61b952cec22f8976cc2a3875e632fc4ad78ba0bc298a276a7048c8bfe7b4fa8f SHA512 c2cac7da8e4f6324c5347b502bc2b5316874ecfaffa2afedd29fee2f4710f28017f9c3940739f0993fbc8e8d214f383bc76f70063482273ad9ab3f8b21aa558f WHIRLPOOL 3a63430fc4b9f95e81caded9a785780d0737938a55a93248ff6f0ce90c253d3c87c0241fa7656e58cb5dab4ac10b71e515fb33567b3e0ac287ab3a51210a1d0d
MISC metadata.xml 2807 SHA256 4a7cd44076cbebb0f35f85765cc1052f665fd794be88d2603de91b5cae1c2218 SHA512 b9a21d9216eb4c69debbbc3fc9b5e2e53d422a374f3de49acc4eb7045bd0ff6377bf1ebbb4f13ea4888eeb8556d420887c08c4bbce9399772ff6cd034be1c6cb WHIRLPOOL 03d06c4ed538dab37c907420ef16940f571490e9ef0a4a6b0eed9ea03b4023159e387bdec3e77ccebe19863e435d66c97096a91f5b2070ea5f7060dc66824f47
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)
iEYEAREIAAYFAlIOKV8ACgkQvFcC4BYPU0rXigCeLmBiDikiFriAqJddk8CtdMI1
ZXsAnRXXe8qOqneTYhuOEH3HjiFBnPU0
=Hkxq
-----END PGP SIGNATURE-----

View File

@ -0,0 +1,47 @@
--- makefile.shared
+++ makefile.shared
@@ -3,7 +3,8 @@
#Tom St Denis
VERSION=0:41
-CC = libtool --mode=compile --tag=CC gcc
+LT ?= libtool
+LTCOMPILE = $(LT) --mode=compile --tag=CC $(CC)
CFLAGS += -I./ -Wall -W -Wshadow -Wsign-compare
@@ -82,21 +83,24 @@
objs: $(OBJECTS)
+%.lo: %.c
+ $(LTCOMPILE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
+
-$(LIBNAME): $(OBJECTS)
- libtool --mode=link gcc *.lo -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION)
+$(LIBNAME): $(OBJECTS:.o=.lo)
+ $(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(LDFLAGS) *.lo -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION)
install: $(LIBNAME)
- install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH)
- libtool --mode=install install -c $(LIBNAME) $(DESTDIR)$(LIBPATH)/$(LIBNAME)
- install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(INCPATH)
- install -g $(GROUP) -o $(USER) $(HEADERS) $(DESTDIR)$(INCPATH)
+ install -d $(DESTDIR)$(LIBPATH)
+ $(LT) --mode=install install -c $(LIBNAME) $(DESTDIR)$(LIBPATH)/$(LIBNAME)
+ install -d $(DESTDIR)$(INCPATH)
+ install -m 644 $(HEADERS) $(DESTDIR)$(INCPATH)
test: $(LIBNAME) demo/demo.o
- gcc $(CFLAGS) -c demo/demo.c -o demo/demo.o
- libtool --mode=link gcc -o test demo/demo.o $(LIBNAME_S)
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c demo/demo.c -o demo/demo.o
+ $(LT) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o test demo/demo.o $(LIBNAME_S)
mtest: test
- cd mtest ; gcc $(CFLAGS) mtest.c -o mtest
+ cd mtest ; $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) mtest.c -o mtest
timing: $(LIBNAME)
- gcc $(CFLAGS) -DTIMER demo/timing.c $(LIBNAME_S) -o ltmtest
+ $(LT) --mode=link $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -DTIMER demo/timing.c $(LIBNAME_S) -o ltmtest

View File

@ -0,0 +1,64 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $Id$
EAPI=5
inherit autotools-multilib eutils multilib toolchain-funcs
DESCRIPTION="highly optimized and portable routines for integer based number theoretic applications"
HOMEPAGE="http://www.libtom.org/"
SRC_URI="http://www.libtom.org/files/ltm-${PV}.tar.bz2"
LICENSE="WTFPL-2"
SLOT="0"
KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~ppc-macos"
IUSE="doc examples static-libs"
DEPEND="sys-devel/libtool"
RDEPEND=""
src_prepare() {
epatch "${FILESDIR}/${P}-makefile.patch"
# need libtool for cross compilation. Bug #376643
cat <<-EOF > configure.ac
AC_INIT(libtommath, 0)
AM_INIT_AUTOMAKE
LT_INIT
AC_CONFIG_FILES(Makefile)
AC_OUTPUT
EOF
touch NEWS README AUTHORS ChangeLog Makefile.am
eautoreconf
# export LT="${S}"/libtool
multilib_copy_sources
}
_emake() {
cd ${BUILD_DIR}
emake CC="$(tc-getCC)" -f makefile.shared \
IGNORE_SPEED=1 \
LIBPATH="${EPREFIX}/usr/$(get_libdir)" \
INCPATH="${EPREFIX}/usr/include" \
"$@"
}
src_compile() {
multilib_foreach_abi _emake
}
src_install() {
multilib_foreach_abi _emake DESTDIR="${ED}" install
# We only link against -lc, so drop the .la file.
find "${ED}" -name '*.la' -delete
dodoc changes.txt
use doc && dodoc *.pdf
if use examples ; then
docinto demo
dodoc demo/*.c
fi
}