2009-01-28 20:27:43 +01:00
|
|
|
# Copyright 2008 Daniel Mierswa <impulze@impulze.org>
|
|
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
|
|
|
|
export_exlib_phases src_prepare src_install
|
|
|
|
|
|
|
|
HOMEPAGE_BASE="http://cr.yp.to"
|
|
|
|
HOMEPAGE_EXTENSION="${HOMEPAGE_EXTENSION:-${PN}.html}"
|
|
|
|
HOMEPAGE="${HOMEPAGE:-${HOMEPAGE_BASE}/${HOMEPAGE_EXTENSION}}"
|
|
|
|
LICENCES="${LICENCES:-public-domain}"
|
|
|
|
DOWNLOADS="${DOWNLOADS:-${HOMEPAGE_BASE}/${PN}/${PNV}.tar.gz}"
|
|
|
|
|
|
|
|
# first give gcc, ranlib and ar a host-triplet
|
|
|
|
# then replace some trivial code with newer extensions of gcc/C to
|
|
|
|
# avoid running binaries on the host to obtain the information (i.e.
|
|
|
|
# support cross-compiling)
|
|
|
|
# TODO: check if iopause.h can be created by us
|
|
|
|
djb_src_prepare() {
|
|
|
|
local basedir=$(dirname $(find -type f -name conf-cc))
|
|
|
|
local ranlib_file=$(grep -r ranlib . | sed 's/:.*//')
|
|
|
|
|
2010-03-11 11:37:00 +01:00
|
|
|
edo sed \
|
2009-01-28 20:27:43 +01:00
|
|
|
-e "/^gcc/s:.*:& ${CPPFLAGS} ${CFLAGS}:" \
|
2010-01-17 14:04:45 +01:00
|
|
|
-e "/^gcc/s:gcc:${CC}:" \
|
2010-03-11 11:37:00 +01:00
|
|
|
-i "${basedir}/conf-cc"
|
2009-01-28 20:27:43 +01:00
|
|
|
|
2010-03-11 11:37:00 +01:00
|
|
|
edo sed \
|
2009-01-28 20:27:43 +01:00
|
|
|
-e "/^gcc/s:.*:& ${LDFLAGS}:" \
|
2010-01-17 14:04:45 +01:00
|
|
|
-e "/^gcc/s:gcc:${LD}:" \
|
2010-03-11 11:37:00 +01:00
|
|
|
-i "${basedir}/conf-ld"
|
2009-01-28 20:27:43 +01:00
|
|
|
|
2010-03-11 11:37:00 +01:00
|
|
|
edo sed \
|
2010-01-17 14:04:45 +01:00
|
|
|
-e "/echo 'ar cr/s:ar:${AR}:" \
|
|
|
|
-e "/*) echo 'ranlib \"\\$/s:ranlib:${RANLIB}:" \
|
2010-03-11 11:37:00 +01:00
|
|
|
-i "${ranlib_file}"
|
2009-01-28 20:27:43 +01:00
|
|
|
|
|
|
|
if [ -f "${basedir}/auto-str.c" ] ; then
|
2010-03-11 11:37:00 +01:00
|
|
|
edo cat >> "${basedir}/auto-str" <<EOF
|
2009-01-28 20:27:43 +01:00
|
|
|
#!/bin/bash
|
|
|
|
printf "const char \${1}[] = \"%s\";\n" \$(printf "\${2}" | od -A n -t o1 | tr ' ' '\\')
|
|
|
|
EOF
|
2010-03-11 11:37:00 +01:00
|
|
|
edo chmod u+x "${basedir}/auto-str"
|
2009-01-28 20:27:43 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f "${basedir}/hasshsgr.h1" ] ; then
|
2010-03-11 11:37:00 +01:00
|
|
|
edo ln -s hasshsgr.h1 "${basedir}"/hasshsgr.h
|
2009-01-28 20:27:43 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f "${basedir}/uint64.h1" ] ; then
|
2010-03-11 11:37:00 +01:00
|
|
|
edo cat >> "${basedir}/uint64.h" <<EOF
|
2009-01-28 20:27:43 +01:00
|
|
|
#ifndef UINT64_H
|
|
|
|
#define UINT64_H
|
|
|
|
|
|
|
|
/* sysdep: -ulong64 */
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
typedef uint64_t uint64;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f "${basedir}/conf-home" ] ; then
|
2010-03-11 11:37:00 +01:00
|
|
|
edo echo /usr > "${basedir}/conf-home"
|
2009-01-28 20:27:43 +01:00
|
|
|
fi
|
2010-12-19 16:54:08 +01:00
|
|
|
|
2009-01-28 20:27:43 +01:00
|
|
|
default
|
|
|
|
}
|
|
|
|
|
|
|
|
djb_src_install() {
|
|
|
|
local hierc_file=$(find -type f -name hier.c)
|
|
|
|
local count dir file opts
|
|
|
|
while read line ; do
|
|
|
|
line=$(echo ${line} | tr ',' ' ' | tr -d '"')
|
|
|
|
count=$(echo ${line} | wc -w)
|
|
|
|
[ ${count} -ne 6 ] && continue
|
|
|
|
dir=$(echo ${line} | awk '{ print $2 }')
|
|
|
|
file=$(echo ${line} | awk '{ print $3 }')
|
|
|
|
opts=$(echo ${line} | awk '{ print $6 }')
|
|
|
|
opts=${opts#?}
|
|
|
|
opts=${opts%??}
|
|
|
|
|
|
|
|
[ ! "${dir%bin}" = "${dir}" ] && dir="/usr/${dir}"
|
|
|
|
|
|
|
|
insinto "${dir}"
|
|
|
|
insopts "-m${opts}"
|
|
|
|
doins "${file}"
|
|
|
|
done < "${hierc_file}"
|
|
|
|
# $(tail -n+8 "${hierc_file}" | head -n-1 | tr ',' ' ' | awk '{ print $3 }' | tr -d '"') ; do
|
|
|
|
}
|
2009-07-29 12:55:27 +02:00
|
|
|
|