1 # Copyright 1999-2009 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 # Copyright 2008 Leonardo Valeri Manera <l.valerimanera@gmail.com>
9 # @BLURB: Eclass for Chicken-Scheme Egg packages
12 # This eclass provides generalized functions to compile, test and
13 # install eggs, as well as setting a number of variables to default
14 # or autogenerated values.
16 # @ECLASS-VARIABLE: NEED_CHICKEN
18 # If you need anything different from chicken 3.0.5, use the
19 # NEED_CHICKEN variable before inheriting elisp.eclass. Set it to the
20 # major version the egg needs and the dependency will be adjusted.
22 # @ECLASS-VARIABLE: EGG_TESTABLE
24 # Enables egg test-phase if set to 'yes'.
26 # @ECLASS-VARIABLE: EGG_NAME
28 # Override egg name autogeneration by settting this before importing
35 VERSION
="${NEED_CHICKEN:-3.1.0}"
36 DEPEND
=">=dev-scheme/chicken-${VERSION}"
37 RDEPEND
=">=dev-scheme/chicken-${VERSION}"
43 EGG_NAME
=${PN/#srfi/srfi-}
46 EGG_NAME
=${EGG_NAME:-${PN}}
50 EGGDOC_DIR
="/usr/share/doc/chicken-eggs/${PN}"
52 SRC_URI
="http://cleo.uwindsor.ca/cgi-bin/gentoo-eggs/${EGG_NAME}-3-${PV}.tar.gz"
54 if [[ -n "${OLD_EGGPAGE}" ]]; then
55 HOMEPAGE
="http://www.call-with-current-continuation.org/eggs/${EGG_NAME}"
57 HOMEPAGE
="http://chicken.wiki.br/${EGG_NAME}"
60 # @FUNCTION: eggs-install_binaries
63 # INstall egg binaries/scripts/wrappers into /usr/bin
64 eggs-install_binaries
() {
65 if [[ -d "${S}/install/${PROGRAM_PATH}" ]]; then
66 pushd "${S}/install/${PROGRAM_PATH}" >/dev
/null
69 einfo
" => /usr/bin/${file}"
70 dobin
"${file}" || die
"failed installing ${file}"
77 # @FUNCTION: eggs-install_files
80 # Install egg files into the correct locations.
81 eggs-install_files
() {
82 local destination
=${1:-${CHICKEN_REPOSITORY}}
83 local real_destination
88 # Hackish, but working, way of displaying real destinations
89 # in info messages. Feel free to improve on it.
90 real_destination
=${EGGDOC_DIR}
91 insinto
"${EGGDOC_DIR}"
95 real_destination
=${destination}
96 insinto
"${destination}"
100 real_destination
=${destination}
101 insinto
"${destination}"
105 if [[ -d "${file}" ]];then
106 # To iterate is human, to recurse, divine.
107 ( cd "${file}"; eggs-install_files "${destination}/${file}" )
109 einfo
" => ${real_destination}/${file}"
110 doins
"${file}" || die
"failed installing ${file}"
116 # @FUNCTION: eggs-set_paths
119 # Modify the .setup-info file(s) to reflect true documentation
120 # installation paths.
122 ebegin
"Processing setup files"
123 for setup_file
in $
(ls *.setup-info
); do
124 einfo
" ${setup_file}"
125 sed -e "s:${PROGRAM_PATH}:/usr/bin:g" \
126 -e "s:${CHICKEN_REPOSITORY}/\(.*\).html:${EGGDOC_DIR}/\1.html:g" \
127 -i "${setup_file}" || die
"failed processing ${setup_file}"
130 einfo
"Done processing setup files."
134 # Ebuild function redefintions
145 filter-ldflags
-Wl,--as-needed
146 CSC_OPTIONS
="-C '$CFLAGS $LDFLAGS'"
148 CHICKEN_SETUP_OPTIONS
="-v -k -build-prefix ${S}/build -install-prefix ${S}/install"
150 chicken-setup
${CHICKEN_SETUP_OPTIONS} || die
"egg compilation failed"
154 if [[ "${EGG_TESTABLE}" == "yes" ]]; then
155 chicken-setup
-n -t ${CHICKEN_SETUP_OPTIONS} || die
"egg test phase failed"
160 CHICKEN_REPOSITORY
=$
(chicken-setup
-R) || die
161 PROGRAM_PATH
=$
(chicken-setup
-P) || die
163 pushd "${S}/install/${CHICKEN_REPOSITORY}" >/dev
/null
165 [[ -f index.html
]] && rm index.html
168 ebegin
"Installing files"
169 eggs-install_binaries
171 einfo
"Done with installation."
176 EXPORT_FUNCTIONS src_unpack src_compile src_test src_install