-
Notifications
You must be signed in to change notification settings - Fork 3
/
captureConfigFiles
executable file
·63 lines (46 loc) · 1.66 KB
/
captureConfigFiles
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
#!/bin/sh
# Use this script to capture the changed configuration files after patching
# glpk's configure.ac, src/Makefile.am, and examples/Makefile.am and running
# run_autotools.
# This assumes that the right run_autotools is found in your PATH!
# Note that glpk's config.h.in is hand-crafted. We don't want the new,
# autogenerated version.
set -e
wgetcmd=wget
glpk_ver=4.65
if [[ ! -r glpk_config.patch ]] ; then
echo "Cannot find configuration patch file glpk_config.patch. Aborting"
exit 1
fi
newConfigFiles=(configure.ac src/Makefile.am examples/Makefile.am)
newConfigFiles+=(compile ar-lib config.guess depcomp install-sh missing)
newConfigFiles+=(ltmain.sh)
newConfigFiles+=(configure Makefile.in src/Makefile.in examples/Makefile.in)
# Pull down a fresh copy of glpk
echo "Downloading the source code from ftp.gnu.org ..."
$wgetcmd http://ftp.gnu.org/gnu/glpk/glpk-${glpk_ver}.tar.gz
echo "Uncompressing the tarball..."
gunzip -f glpk-${glpk_ver}.tar.gz
if test -d glpk ; then
echo "Moving current glpk to glpk.OLD."
if test -d glpk.OLD ; then
rm -rf glpk.OLD
fi
mv glpk glpk.OLD
fi
echo "Unpacking the source code..."
tar xf glpk-${glpk_ver}.tar
echo "Deleting the tar file..."
rm glpk-${glpk_ver}.tar
mv glpk-${glpk_ver} glpk
echo "Hiding glpk's m4 directory to avoid obsolete libtool macros."
mv glpk/m4 glpk/m4.hidden
echo "Patching configuration source files ..."
patch -p0 < glpk_config.patch
echo "Running autotools on patched source ..."
run_autotools -f glpk
echo "Capturing modified configuration files in glpk_config_files/..."
for f in "${newConfigFiles[@]}" ; do
mkdir -p `dirname glpk_config_files/$f`
cp -f glpk/$f glpk_config_files/$f
done