-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.templ
executable file
·196 lines (166 loc) · 6.66 KB
/
build.templ
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#!/usr/bin/env bash
#
# This is the script we use to build SWI-Prolog and all its packages.
# Copy the script to `build', edit to suit the local installation
# requirements and run it. Once correct, upgrading to a new release is
# now limited to getting the new sources and run ./build.
# [EDIT] Prefix location of the installation. It is _not_ adviced to use
# a versioned prefix. The system will install in
# $PREFIX/lib/pl-<version> and create symlinks from $PREFIX/bin for the
# main programs. Users can always use older versions by running
# $PREFIX/lib/pl-<version>/bin/<arch>/pl
#
# If you change PREFIX such that the system is installed in a place for
# which you have no write access, set SUDO to the command to run the
# remainder of the commandline as privilaged user. E.g., if you change
# PREFIX to /usr/local/bin you typically must change SUDO to "sudo"
PREFIX=$HOME
SUDO=
#SUDO="sudo"
# [EDIT] Version of make to use. This must be GNU-make. On many Unix
# systems this is installed as 'gmake'. On most GNU-based systems (e.g.,
# linux), the default make is GNU-make. You can use 'make --jobs=<max>'
# to build the system faster using all your cores. The optimal value
# depends a lot on your hardware. Using 4 jobs on a dual-core machines
# seems enough to keep both cores busy. (experimental).
MAKE=make
# MAKE='make --jobs=4'
# [EDIT] Compiler and options.
#
# CC: Which C-compiler to use
# COFLAGS: Flags for the optimizer such as "-O3" or "-g"
# CMFLAGS: Machine flags such as "-m64" (64-bits on gcc)
# CIFLAGS: Include-path such as "-I/opt/include"
# LDFLAGS: Link flags such as "-L/opt/lib"
#
# Leaving an option blank leaves the choice to configure. The commented
# values below enable much better C-level debugging with almost the same
# performance on GCC based systems (the default is to compile using -O3)
# For optiomal performance, see also --enable-useprofile below.
# export CC=
# export COFLAGS="-O2 -gdwarf-2 -g3 -fno-strict-aliasing"
# export CMFLAGS=
# export CIFLAGS=
# export LDFLAGS="-O2 -g"
# On MacOS you need this to get some libraries from Macports
if [ "`uname`" = Darwin ]; then
export LIBRARY_PATH=/usr/lib:/opt/local/lib
export CPATH=/usr/include:/opt/local/include
export PKG_CONFIG_PATH=/usr/X11R6/lib/pkgconfig:/opt/local/lib/pkgconfig
export CXXCPP="g++ -E"
fi
# [EDIT] On Solaris also puts there stuff everywhere ...
# export CIFLAGS=-I/opt/csw/include/ncurses
# export LDFLAGS=-L/opt/csw/lib
# [EDIT] On FreeBSD, java is installed under /usr/local/jdk<version>,
# and the executables are _copied_ to /usr/local/bin. Unfortunately, the
# copy leaves the headers out, so the original files must be used.
# export JAVAC=/usr/local/jdk1.6.0/bin/javac
# [EDIT] On FreeBSD, the following is needed to fetch the headers for
# GMP.
# export CIFLAGS='-I/usr/local/include'
export CFLAGS="$COFLAGS $CMFLAGS $CIFLAGS"
################################################################
# Package (add-ons) selection
################################################################
# [EDIT] Packages to configure. Leaving it blank compiles all default
# packages. The final set of packages is
#
# ${PKG-<default>} + $EXTRA_PKGS - $DISABLE_PKGS
# export PKG=
# [EDIT] Packages to skip. Leaving it blank compiles all packages.
# export DISABLE_PKGS="jpl ssl odbc"
# [EDIT] Packages to add.
# export EXTRA_PKGS="db ltx2htm space"
# [EDIT] Where to find the jar for Junit 3.8. Needed to test jpl
# export JUNIT=/opt/local/share/java/junit.jar
################################################################
# Misc stuff
################################################################
# [EDIT] Extra options to pass to the toplevel configure.
# --link
# Using --link, the system is installed using symbolic links. This means
# you cannot remove or clean the sources, but it largely simplifies
# editing the system Prolog files during development.
#
# --enable-useprofile
# The config --enable-useprofile exploits GCC -fprofile-use option. The
# system is compiled, profiled and re-compiled to get better
# branch-prediction. This makes the system approx. 10% faster. Do not
# use this for developing the kernel because it complicates maintenance.
#
# --disable-libdirversion
# By default, the system is installed in $libdir/swipl-<version>. Using
# this option drops <version>. Using versions, you can install multiple
# versions side-by-site and run old versions at any time by starting
# $libdir/swipl-<version>/bin/$arch/swipl. Without, the system is always
# at a nice stable place, so external foreign objects linked against the
# binary need not be updated with a Prolog update.
#
# --enable-shared
# Use this to create a shared object for the Prolog kernel. The default
# depends on the platform. Creating a shared object is the default on
# most platforms, either because it is needed or because it does no
# harm. The only exception to this rule is Linux on x86 (Intel 32-bit).
# It is not needed on this platform and Linux shared object model costs
# a CPU register. Given the limited number of CPU registers on the x86
# platform, this results in a performance degradation of about 10%.
#
# EXTRACFG+=" --link"
# EXTRACFG+=" --enable-useprofile"
# EXTRACFG+=" --disable-libdirversion"
# EXTRACFG+=" --enable-shared"
export EXTRACFG
# One possiblity to make relocatable executables on Linux is by using
# the RPATH mechanism. See ld.so(1) and chrpath(1). However, chrpath
# cannot enlarge the path. Uncommenting the line below adds :xxx... to
# the RPATH, where the given count is the number of x-s.
#
# export RPATH_RESERVE=70
################################################################
# No edit should be needed below this line
################################################################
V=`cat VERSION`
config=true
make=true
install=true
done=false
setvars=false
while test "$done" = false; do
case "$1" in
--config) make=false
install=false
shift
;;
--make) config=false
install=false
shift
;;
--install) config=false
make=false
shift
;;
--prefix=*) PREFIX=`echo "$1" | sed 's/--prefix=//'`
shift
;;
--setvars) setvars=true
shift
;;
*) done=true
;;
esac
done
if [ "$setvars" = "false" ]; then
if [ "$config" = "true" ]; then
./configure --prefix=$PREFIX --with-world $EXTRACFG $@ 2>&1 | tee configure.out
if [ "${PIPESTATUS[0]}" != 0 ]; then exit 1; fi
fi
if [ "$make" = "true" ]; then
$MAKE $@ 2>&1 | tee make.out
if [ "${PIPESTATUS[0]}" != 0 ]; then exit 1; fi
fi
if [ "$install" = "true" ]; then
$SUDO $MAKE install $@ 2>&1 | tee make-install.out
if [ "${PIPESTATUS[0]}" != 0 ]; then exit 1; fi
fi
fi # setvars