summaryrefslogtreecommitdiff
path: root/lang/modula-3-lib/scripts/configure
blob: 7360b086b39102863a0ea576a8dbf6a1d72ca0f9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#! /bin/sh
#
# $FreeBSD$

umask 022

temp_prefix=${WRKSRC}/installed
plist_src=${PKGDIR}/${PLIST##*/}
template_src=${FILESDIR}/FreeBSD2.${PORTOBJFORMAT}
template="${WRKSRC}/m3/m3build/templates/FreeBSD2"

if [ "${PORTOBJFORMAT}" = aout -a -f /usr/lib/aout/crt0.o ]; then
    crt0=/usr/lib/aout/crt0.o
else
    crt0=/usr/lib/crt0.o
fi
if [ "${PORTOBJFORMAT}" = aout -a -f /usr/lib/aout/libgcc.a ]; then
    libgcc=/usr/lib/aout/libgcc.a
else
    libgcc=/usr/lib/libgcc.a
fi

# Copy the appropriate m3build template file into place, patching up
# various pathnames in the process.
rm -f ${template}
sed -e "s|/usr/local/|${temp_prefix}/|g" \
    -e "s|!PREFIX!|${PREFIX}|g" \
    -e "s|/usr/lib/crt0\.o|${crt0}|g" \
    -e "s|/usr/lib/libgcc\.a|${libgcc}|g" \
    ${template_src} >${template}

# Our PLIST templates contain only the "libfoo.so" names for shared
# libraries.  Here we add the "libfoo.so.${MAJOR}" names.  This saves
# us from having to fix the PLIST every time we bump the version number.
sed -e "/\.so\$/p" \
    -e "s/\.so\$/&.${MAJOR}/" \
    ${plist_src} > ${PLIST}

# Also generate a "PLIST.real" file which includes the minor version
# numbers on shared library names if the object format is a.out.
if [ "${PORTOBJFORMAT}" = aout ]; then
    sed -e "s/\.so\.${MAJOR}\$/&.0/" ${PLIST} > ${PLIST}.real
else
    cp ${PLIST} ${PLIST}.real
fi