Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 48053d0

Browse files
author
Matthias Koeppe
committed
lcalc: Split out spkg-build from spkg-install
1 parent b595edd commit 48053d0

File tree

2 files changed

+80
-64
lines changed

2 files changed

+80
-64
lines changed

build/pkgs/lcalc/spkg-build

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/usr/bin/env bash
2+
3+
if [ -z "$SAGE_LOCAL" ]; then
4+
echo >&2 "Error: SAGE_LOCAL undefined ... exiting"
5+
echo >&2 "Maybe run 'sage -sh'?"
6+
exit 1
7+
fi
8+
9+
if [ "x$SAGE64" = xyes ]; then
10+
echo "Building a 64-bit version of lcalc"
11+
12+
# Both Sun and GNU compilers use -m64 to build 64-bit code, but compilers
13+
# from IBM (on AIX), and HP (on HP-UX) do not. So allow the environment
14+
# variables CFLAG64 and CXXFLAG64 to set the flag to whatever option the
15+
# C and C++ compilers want for 64-bit code. If not set, default to -m64.
16+
17+
if [ -z "$CFLAG64" ]; then
18+
CFLAG64=-m64
19+
fi
20+
if [ -z "$CXXFLAG64" ]; then
21+
CXXFLAG64="$CFLAG64" # default to that of the C compiler
22+
fi
23+
24+
CFLAGS="$CFLAGS $CFLAG64"
25+
CXXFLAGS="$CXXFLAGS $CXXFLAG64"
26+
fi
27+
28+
# If SAGE_DEBUG is set to 'yes', add debugging information. Since both
29+
# the Sun and GNU compilers accept -g to give debugging information,
30+
# there is no need to do anything specific to one compiler or the other.
31+
if [ "x$SAGE_DEBUG" = xyes ]; then
32+
echo "Code will be built with debugging information present. Unset 'SAGE_DEBUG'"
33+
echo "or set it to 'no' if you don't want that."
34+
35+
CFLAGS="$CFLAGS -O0 -g"
36+
CXXFLAGS="$CXXFLAGS -O0 -g"
37+
else
38+
echo "No debugging information will be used during the build of this package."
39+
echo "Set 'SAGE_DEBUG' to 'yes' if you want debugging information present (-g added)."
40+
fi
41+
42+
# Export everything. Probably not necessary in most cases.
43+
export CFLAGS
44+
export CXXFLAGS
45+
46+
success() {
47+
if [ $? -ne 0 ]; then
48+
echo >&2 "Error building the Lcalc package: '$1'"
49+
exit 1
50+
fi
51+
}
52+
53+
export DEFINES=""
54+
55+
cd src
56+
57+
# Apply Sage-specific patches: (See SPKG.txt for details on the patches.)
58+
echo "Patching the upstream source code for Sage..."
59+
for patch in ../patches/*.patch; do
60+
patch -p1 < "$patch"
61+
success "patch $patch failed to apply"
62+
done
63+
64+
# There's currently no 'configure' script for Lcalc; we (also) configure
65+
# it by patching the Makefile. This may change in a later release of Lcalc.
66+
67+
cd src # Now we are in src/src.
68+
69+
# Build everything:
70+
echo "Now building lcalc, example programs and the shared library..."
71+
$MAKE
72+
success "$MAKE"
73+

build/pkgs/lcalc/spkg-install

100755100644
Lines changed: 7 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -6,81 +6,24 @@ if [ -z "$SAGE_LOCAL" ]; then
66
exit 1
77
fi
88

9-
if [ "x$SAGE64" = xyes ]; then
10-
echo "Building a 64-bit version of lcalc"
11-
12-
# Both Sun and GNU compilers use -m64 to build 64-bit code, but compilers
13-
# from IBM (on AIX), and HP (on HP-UX) do not. So allow the environment
14-
# variables CFLAG64 and CXXFLAG64 to set the flag to whatever option the
15-
# C and C++ compilers want for 64-bit code. If not set, default to -m64.
9+
cd src
1610

17-
if [ -z "$CFLAG64" ]; then
18-
CFLAG64=-m64
19-
fi
20-
if [ -z "$CXXFLAG64" ]; then
21-
CXXFLAG64="$CFLAG64" # default to that of the C compiler
22-
fi
11+
echo "Now installing lcalc binary, library and header files..."
12+
rm -fr "$SAGE_LOCAL"/include/libLfunction
2313

24-
CFLAGS="$CFLAGS $CFLAG64"
25-
CXXFLAGS="$CXXFLAGS $CXXFLAG64"
26-
fi
14+
cd src # Now we are in src/src.
2715

28-
# If SAGE_DEBUG is set to 'yes', add debugging information. Since both
29-
# the Sun and GNU compilers accept -g to give debugging information,
30-
# there is no need to do anything specific to one compiler or the other.
31-
if [ "x$SAGE_DEBUG" = xyes ]; then
32-
echo "Code will be built with debugging information present. Unset 'SAGE_DEBUG'"
33-
echo "or set it to 'no' if you don't want that."
16+
$MAKE install INSTALL_DIR="$SAGE_LOCAL"
3417

35-
CFLAGS="$CFLAGS -O0 -g"
36-
CXXFLAGS="$CXXFLAGS -O0 -g"
37-
else
38-
echo "No debugging information will be used during the build of this package."
39-
echo "Set 'SAGE_DEBUG' to 'yes' if you want debugging information present (-g added)."
18+
if [ "$UNAME" = "Darwin" ]; then
19+
install_name_tool -id ${SAGE_LOCAL}/lib/libLfunction.dylib "${SAGE_LOCAL}"/lib/libLfunction.dylib
4020
fi
4121

42-
# Export everything. Probably not necessary in most cases.
43-
export CFLAGS
44-
export CXXFLAGS
45-
4622
success() {
4723
if [ $? -ne 0 ]; then
4824
echo >&2 "Error building the Lcalc package: '$1'"
4925
exit 1
5026
fi
5127
}
5228

53-
export DEFINES=""
54-
55-
# Set installation directory
56-
export INSTALL_DIR="$SAGE_LOCAL/"
57-
58-
cd src
59-
60-
# Apply Sage-specific patches: (See SPKG.txt for details on the patches.)
61-
echo "Patching the upstream source code for Sage..."
62-
for patch in ../patches/*.patch; do
63-
patch -p1 < "$patch"
64-
success "patch $patch failed to apply"
65-
done
66-
67-
# There's currently no 'configure' script for Lcalc; we (also) configure
68-
# it by patching the Makefile. This may change in a later release of Lcalc.
69-
70-
cd src # Now we are in src/src.
71-
72-
# Build everything:
73-
echo "Now building lcalc, example programs and the shared library..."
74-
$MAKE
75-
success "$MAKE"
76-
77-
# Install everything
78-
echo "Now installing lcalc binary, library and header files..."
79-
rm -fr "$SAGE_LOCAL"/include/libLfunction
80-
$MAKE install
81-
82-
if [ "$UNAME" = "Darwin" ]; then
83-
install_name_tool -id ${SAGE_LOCAL}/lib/libLfunction.dylib "${SAGE_LOCAL}"/lib/libLfunction.dylib
84-
fi
85-
8629
success "$MAKE install"

0 commit comments

Comments
 (0)