Skip to content

Commit

Permalink
inchi: Add static-libs USE flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinis committed Oct 19, 2012
1 parent 8a12214 commit a83a181
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sci-libs/inchi/ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# ChangeLog for sci-libs/inchi
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
# $Header: $

*inchi-1.04 (19 Oct 2012)

19 Oct 2012; Reinis Danne <rei4dan@gmail.com> +files/inchi-1.03-shared.patch,
+inchi-1.04.ebuild, +files/inchi-1.04-static.patch, +metadata.xml:
Add static-libs USE flag.

2 changes: 2 additions & 0 deletions sci-libs/inchi/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DIST inchi-1.04-doc.zip 2128303 SHA256 abede36063e838614aa6ade7f20f386f557a78aefb041e1ba0b736088a6a79bc SHA512 930fe10ac2bae11074b7e47446b5af9c01e2aa55f891d04912c71c76e214871c78cc22b3dafea99b57eede5080ac0cfaa6b6d35a73242c8549bea8ffa86e7df7 WHIRLPOOL 5cb5884dbfc9f2e530deb8be0e35643b0a6af70a5b4e069cd610407fac067261a3282ad9db22651fc2efc313ade78930de10ff165dd709a83880815b89e4a4fd
DIST inchi-1.04.zip 2701930 SHA256 c187573c0f6a1fcd555393315383bd1f69563ee47bd43c898f17c473b7bb690a SHA512 c5a1c2f08d472fcde603acbd898a9a8880407474869eadf0089444503693ae89ff805c579161cb3ee9d7f18e891289a21c4b8a65cc7ece69ee730f7f4e283be4 WHIRLPOOL 89a7ac2f80a9a87a663934bd0f24af6aed77f51115bf0b4858f66c135f932b67dff7bbffa16999ab79f7ca1358ef716fa5f11cb8756011f7622f6440470c59e4
20 changes: 20 additions & 0 deletions sci-libs/inchi/files/inchi-1.03-shared.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
INCHI_API/gcc_so_makefile/makefile | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/INCHI_API/gcc_so_makefile/makefile b/INCHI_API/gcc_so_makefile/makefile
index dd8e53c..cd617ad 100644
--- a/INCHI_API/gcc_so_makefile/makefile
+++ b/INCHI_API/gcc_so_makefile/makefile
@@ -213,9 +213,11 @@ $(INCHI_LIB_PATHNAME).so$(VERSION): $(INCHI_LIB_OBJS)
$(SHARED_LINK) $(SHARED_LINK_PARM) -o \
$(INCHI_LIB_PATHNAME).so$(VERSION) \
$(INCHI_LIB_OBJS) \
- -Wl$(LINUX_MAP)$(LINUX_Z_RELRO),-soname,$(INCHI_LIB_NAME).so$(MAIN_VERSION)
+ -Wl$(LINUX_MAP)$(LINUX_Z_RELRO),-soname,$(INCHI_LIB_NAME).so$(MAIN_VERSION) -lm
ln -fs $(INCHI_LIB_NAME).so$(VERSION) \
$(INCHI_LIB_PATHNAME).so$(MAIN_VERSION)
+ ln -fs $(INCHI_LIB_NAME).so$(VERSION) \
+ $(INCHI_LIB_PATHNAME).so

endif

25 changes: 25 additions & 0 deletions sci-libs/inchi/files/inchi-1.04-static.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--- INCHI_API/gcc_so_makefile/makefile 2012-05-13 14:52:53.587632989 +0300
+++ INCHI_API/gcc_so_makefile/makefile 2012-05-13 14:52:11.668635419 +0300
@@ -209,6 +209,13 @@

else

+ifdef STATIC
+
+libinchi.a: $(INCHI_LIB_OBJS)
+ ar rcs $(INCHI_LIB_PATHNAME).a $(INCHI_LIB_OBJS)
+
+else
+
$(INCHI_LIB_PATHNAME).so$(VERSION): $(INCHI_LIB_OBJS)
$(SHARED_LINK) $(SHARED_LINK_PARM) -o \
$(INCHI_LIB_PATHNAME).so$(VERSION) \
@@ -219,6 +226,8 @@

endif

+endif
+
# === InChI Library compile rule =========

%.o: $(P_LIBR)%.c
81 changes: 81 additions & 0 deletions sci-libs/inchi/inchi-1.04.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=4

inherit eutils toolchain-funcs

DESCRIPTION="A program and library for generating standard and non-standard InChI and InChIKeys"
HOMEPAGE="http://www.iupac.org/inchi/"
SRC_URI="
http://www.inchi-trust.org/sites/default/files/inchi-${PV}/INCHI-1-API.ZIP -> ${P}.zip
doc? ( http://www.inchi-trust.org/sites/default/files/inchi-${PV}/INCHI-1-DOC.ZIP -> ${P}-doc.zip )"

LICENSE="IUPAC-InChi"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="doc static-libs"

DEPEND="app-arch/unzip"
RDEPEND=""

S="${WORKDIR}"/INCHI-1-API

src_prepare() {
epatch "${FILESDIR}"/${PN}-1.03-shared.patch
epatch "${FILESDIR}"/${PN}-1.04-static.patch
}

src_compile() {
for dir in INCHI/gcc/inchi-1 INCHI_API/gcc_so_makefile; do
pushd ${dir} > /dev/null
emake \
C_COMPILER=$(tc-getCC) \
CPP_COMPILER=$(tc-getCXX) \
LINKER="$(tc-getCXX) ${LDFLAGS}" \
SHARED_LINK="$(tc-getCC) ${LDFLAGS} -shared" \
C_COMPILER_OPTIONS="\${P_INCL} -ansi -DCOMPILE_ANSI_ONLY ${CFLAGS} -c " \
CPP_COMPILER_OPTIONS="\${P_INCL} -D_LIB -ansi ${CXXFLAGS} -frtti -c " \
C_OPTIONS="${CFLAGS} -fPIC -c " \
LINKER_OPTIONS="${LDFLAGS}" \
CREATE_MAIN= \
ISLINUX=1
popd
done
if use static-libs ; then
pushd INCHI_API/gcc_so_makefile > /dev/null
emake libinchi.a \
C_COMPILER=$(tc-getCC) \
CPP_COMPILER=$(tc-getCXX) \
LINKER="$(tc-getCXX) ${LDFLAGS}" \
SHARED_LINK="$(tc-getCC) ${LDFLAGS} -shared" \
C_COMPILER_OPTIONS="\${P_INCL} -ansi -DCOMPILE_ANSI_ONLY ${CFLAGS} -c " \
CPP_COMPILER_OPTIONS="\${P_INCL} -D_LIB -ansi ${CXXFLAGS} -frtti -c " \
C_OPTIONS="${CFLAGS} -fPIC -c " \
LINKER_OPTIONS="${LDFLAGS}" \
CREATE_MAIN= \
ISLINUX=1 \
STATIC=1
popd
fi
}

src_install() {
dodoc readme*.txt
if use doc ; then
cd "${WORKDIR}/INCHI-1-DOC/"
docinto doc
dodoc *.pdf readme.txt
fi
cd "${S}/INCHI/gcc/inchi-1"
dobin inchi-1
cd "${S}/INCHI_API/gcc_so_makefile/result"
rm *gz
dolib.so lib*
if use static-libs ; then
dolib.a lib*.a
fi
insinto /usr/include
doins ../../inchi_main/inchi_api.h
}
8 changes: 8 additions & 0 deletions sci-libs/inchi/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<herd>sci-chemistry</herd>
<longdescription>
Program v1.04 implementing IUPAC (Standard) InChI/InChIKey version 1.
</longdescription>
</pkgmetadata>

0 comments on commit a83a181

Please sign in to comment.