Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 390169

Summary: ebuild for ADMB (Automatic Differentiation Model Builder) software suite
Product: Gentoo Linux Reporter: Hugo Mildenberger <Hugo.Mildenberger>
Component: New packagesAssignee: Default Assignee for New Packages <maintainer-wanted>
Status: UNCONFIRMED ---    
Severity: normal CC: Hugo.Mildenberger
Priority: Normal Keywords: EBUILD
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://admb-project.org
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: metadata for admb package
admb 10.1 patch 1 .. 12

Description Hugo Mildenberger 2011-11-11 10:56:35 UTC
Created attachment 292185 [details]
metadata for admb package

Citing http://admb-project.org: "The ADMB(Automatic Differentiation Model Builder) software suite is an environment for non-linear statistical modeling enabling rapid model development, numerical stability, fast and efficient computation, and high accuracy parameter estimates.  ADModel Builder is a high level language built around the AUTODIF Library, a C++ language extension which transparently implements reverse mode automatic differentiation.  A closely related software package, ADMB-RE, implements random effects in non-linear models"

There is also an R package R2admb hosted at sourceforge, here: https://r-forge.r-project.org/projects/r2admb/
Comment 1 Hugo Mildenberger 2011-11-11 10:59:27 UTC
# Copyright 2011 Hugo Mildenberger <Hugo.Mildenberger@web.de>
# Distributed under the terms of the GNU General Public License v2

EAPI=4

DESCRIPTION="ADMB (Automatic Differentiation Model Builder) software suite"
LICENSE="BSD-4"
HOMEPAGE="http://admb-project.org"
SRC_URI="http://admb-project.googlecode.com/files/${P}.zip"

SLOT="0"
IUSE="doc examples"
KEYWORDS="~amd64 ~x86"
DEPENDS="sys-devel/flex"

inherit eutils

src_prepare() {
	# Force regeneration of tpl2rem.c from tpl2rem.lex
	rm -f "${S}/src/df1b2-separable/tpl2rem.c"

	# Force regeneration of tpl2cpp.c from tpl2cpp.lex
	rm -f "${S}/src/src/nh99/tpl2cpp.c"

	epatch "${FILESDIR}/${P}-enable64-respect-cxxflags-configure-home.patch"
	epatch "${FILESDIR}/${P}-respect-cxxflags.patch"
	epatch "${FILESDIR}/${P}-fix-cp-scripts-g++.patch"
	epatch "${FILESDIR}/${P}-tpl2rem-use-configured-home.patch"
	epatch "${FILESDIR}/${P}-optg32-rh8-laplace-mak-add-tpl2rem-dep.patch"
	epatch "${FILESDIR}/${P}-nh99-optg32-rh8-laplace-mak-add-tpl2cpp-dep.patch"
	epatch "${FILESDIR}/${P}-fix-parallel-make.patch"
	epatch "${FILESDIR}/${P}-tpl2cpp-fix-segv-on-temp-open-fail.patch"

	# Reduce the enormous amount of warnings to increase awareness to 
	# possibly important ones. This patch isn't strictly necessary.
	epatch "${FILESDIR}/${P}-fix-g++-warnings.patch"

	# Amended copies of original files: get rid of the need to set ADMB_HOME
	EPATCH_OPTS="-p2"
	epatch "${FILESDIR}/${P}-admb-show-configured-home.patch"
	epatch "${FILESDIR}/${P}-adlink-use-configured-home.patch"
	epatch "${FILESDIR}/${P}-adcomp-use-configured-home.patch"

	cd "${S}/scripts/configure" && make # make runs autoconf here
}

src_test() {
	# Try to emulate the verify target until there is a real test suite
	cp -a "${S}/examples/" "${T}/examples.work"  || die
	chmod a+x "${S}/build/unix/unix/bin/admb"    || die
	chmod a+x "${S}/build/unix/unix/bin/adlink"  || die
	chmod a+x "${S}/build/unix/unix/bin/adcomp"  || die

	# Use just the programs and scripts just build
	# CXXFLAGS and LDFLAGS confuse tpl2cpp and tpl2rem 
	ADMB_HOME="${S}/build/unix/unix" \
	PATH="${S}/build/unix/unix/bin:${PATH}" \
	 make CXXFLAGS="" LDFLAGS="" -C "${T}/examples.work"\
								 -f "${S}/scripts/g++/Makefile" all

}

src_install() {
	# ADMB Makefiles should be rewritten to respect configured directories 

	dobin  build/unix/unix/bin/admb\
	       build/unix/unix/bin/adcomp\
	       build/unix/unix/bin/adlink\
	       build/unix/unix/bin/tpl2cpp\
	       build/unix/unix/bin/tpl2rem

	# As long as ADM_HOME is there, includes are expected in datadir
	insinto /usr/share/${PN}/include
	doins  build/unix/unix/include/*

	# As long as ADM_HOME is there, libraries are expected in datadir
	insinto /usr/share/${PN}/lib
	doins  build/unix/unix/lib/*

	# Actually, these are sed templates
	insinto /usr/share/${PN}/bin
	for template in sedcmd sedcmd2 sedcmd3 seddf1b2 seddf1b3\
	              seddf1b4 sedf1b2a sedf1b2c sedf1b2d sedflex; do
		doins build/unix/unix/bin/${template};
	done

	# Examples could reside in doc. But then the contents of the many 
	# directories would get compressed recursively, which would be very
	# discouraging 
	use examples && insinto /usr/share/${PN}\
	             && doins -r build/unix/unix/examples

	# Todo: there is so much lovingly written LaTeX documentation.
	use doc && dodoc build/unix/unix/LICENSE\
		    && dodoc build/unix/unix/README.txt\
	        && dodoc docs/manuals/admb-re/ADMBprim.pdf
}
Comment 2 Hugo Mildenberger 2011-11-11 11:08:10 UTC
Created attachment 292187 [details]
admb 10.1 patch 1 .. 12

tar archive, containing 
admb-10.1-adcomp-use-configured-home.patch
admb-10.1-adlink-use-configured-home.patch
admb-10.1-admb-show-configured-home.patch
admb-10.1-enable64-respect-cxxflags-configure-home.patch
admb-10.1-fix-cp-scripts-g++.patch
admb-10.1-fix-g++-warnings.patch
admb-10.1-fix-parallel-make.patch
admb-10.1-nh99-optg32-rh8-laplace-mak-add-tpl2cpp-dep.patch
admb-10.1-optg32-rh8-laplace-mak-add-tpl2rem-dep.patch
admb-10.1-respect-cxxflags.patch
admb-10.1-tpl2cpp-fix-segv-on-temp-open-fail.patch
admb-10.1-tpl2rem-use-configured-home.patch