1 | #!/bin/sh |
---|
2 | |
---|
3 | # Use this script to capture the changed configuration files after patching |
---|
4 | # glpk's configure.ac, src/Makefile.am, and examples/Makefile.am and running |
---|
5 | # run_autotools. |
---|
6 | # This assumes that the right run_autotools is found in your PATH! |
---|
7 | |
---|
8 | # Note that glpk's config.h.in is hand-crafted. We don't want the new, |
---|
9 | # autogenerated version. |
---|
10 | |
---|
11 | set -e |
---|
12 | |
---|
13 | wgetcmd=wget |
---|
14 | glpk_ver=4.65 |
---|
15 | |
---|
16 | if [[ ! -r glpk_config.patch ]] ; then |
---|
17 | echo "Cannot find configuration patch file glpk_config.patch. Aborting" |
---|
18 | exit 1 |
---|
19 | fi |
---|
20 | |
---|
21 | newConfigFiles=(configure.ac src/Makefile.am examples/Makefile.am) |
---|
22 | newConfigFiles+=(compile ar-lib config.guess depcomp install-sh missing) |
---|
23 | newConfigFiles+=(ltmain.sh) |
---|
24 | newConfigFiles+=(configure Makefile.in src/Makefile.in examples/Makefile.in) |
---|
25 | |
---|
26 | # Pull down a fresh copy of glpk |
---|
27 | |
---|
28 | echo "Downloading the source code from ftp.gnu.org ..." |
---|
29 | $wgetcmd http://ftp.gnu.org/gnu/glpk/glpk-${glpk_ver}.tar.gz |
---|
30 | |
---|
31 | echo "Uncompressing the tarball..." |
---|
32 | gunzip -f glpk-${glpk_ver}.tar.gz |
---|
33 | |
---|
34 | if test -d glpk ; then |
---|
35 | echo "Moving current glpk to glpk.OLD." |
---|
36 | if test -d glpk.OLD ; then |
---|
37 | rm -rf glpk.OLD |
---|
38 | fi |
---|
39 | mv glpk glpk.OLD |
---|
40 | fi |
---|
41 | |
---|
42 | echo "Unpacking the source code..." |
---|
43 | tar xf glpk-${glpk_ver}.tar |
---|
44 | |
---|
45 | echo "Deleting the tar file..." |
---|
46 | rm glpk-${glpk_ver}.tar |
---|
47 | |
---|
48 | mv glpk-${glpk_ver} glpk |
---|
49 | |
---|
50 | echo "Hiding glpk's m4 directory to avoid obsolete libtool macros." |
---|
51 | mv glpk/m4 glpk/m4.hidden |
---|
52 | |
---|
53 | echo "Patching configuration source files ..." |
---|
54 | patch -p0 < glpk_config.patch |
---|
55 | |
---|
56 | echo "Running autotools on patched source ..." |
---|
57 | run_autotools -f glpk |
---|
58 | |
---|
59 | echo "Capturing modified configuration files in glpk_config_files/..." |
---|
60 | for f in "${newConfigFiles[@]}" ; do |
---|
61 | mkdir -p `dirname glpk_config_files/$f` |
---|
62 | cp -f glpk/$f glpk_config_files/$f |
---|
63 | done |
---|