| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # Install newer version of autotools, automake, libtool, and pkgconfig on CentOS 7 |
| 3 | |
| 4 | if [scip-shell system . . `[`. ! -f /etc/os-releasescip-shell filesystem . . `/etc/os-release`. ]; then |
| 5 | echoscip-shell system . . echo. 'os-release not present, aborting' |
| 6 | exit 1 |
| 7 | fi |
| 8 | |
| 9 | . /etc/os-releasescip-shell source . . `/etc/os-release`. |
| 10 | |
| 11 | # Untested on Red Hat |
| 12 | if [scip-shell system . . `[`. "x${ID}" != 'xcentos' ] && [scip-shell system . . `[`. "x${ID}" != 'xredhat' ]; then |
| 13 | echoscip-shell system . . echo. 'OS is not CentOS or Red Hat, aborting' |
| 14 | exit 1 |
| 15 | fi |
| 16 | |
| 17 | if [scip-shell system . . `[`. "x${VERSION_ID}" != 'x7' ]; then |
| 18 | echoscip-shell system . . echo. "Invalid CentOS/Red Hat version. Expected 7, got ${VERSION_ID}, aborting" |
| 19 | exit 1 |
| 20 | fi |
| 21 | |
| 22 | yum install epel-release |
| 23 | |
| 24 | # Install packages if not already present |
| 25 | # Yeah, automake is required to build a newer version of automake |
| 26 | PACKAGES="tar glib2-devel gcc gcc-c++ make m4 perl-Data-Dumper help2man automake" |
| 27 | NB_INSTALLED_PKG=$(yum list install ${PACKAGES} | sedscip-shell system . . sed. -n '/Installed Packages/,$pscip-shell filesystem . . `/Installed Packages/,$p`.' | wcscip-shell system . . wc. -l) |
| 28 | # Count includes the "Installed Packages" line, so decreasing count by 1 |
| 29 | NB_INSTALLED_PKG=$((NB_INSTALLED_PKG-1)) |
| 30 | NB_PKG=$(echoscip-shell system . . echo. ${PACKAGES} | wcscip-shell system . . wc. -w) |
| 31 | [scip-shell system . . `[`. ${NB_PKG} -ne ${NB_INSTALLED_PKG} ] && yum install ${PACKAGES} |
| 32 | |
| 33 | autoconf_version=2.69 |
| 34 | automake_version=1.16.1 |
| 35 | libtool_version=2.4.6 |
| 36 | pkgconf_version=0.29 |
| 37 | |
| 38 | TMP_DIR=$(mktempscip-shell system . . mktemp. -d) |
| 39 | cd ${TMP_DIR} |
| 40 | |
| 41 | echoscip-shell system . . echo. "Installing autoconf ${autoconf_version}" |
| 42 | curlscip-shell system . . curl. -L http://ftp.gnu.org/gnu/autoconf/autoconf-${autoconf_version}.tar.xz > autoconf-${autoconf_version}.tar.xz \ |
| 43 | && tarscip-shell system . . tar. xJf autoconf-${autoconf_version}.tar.xz \ |
| 44 | && cd autoconf-${autoconf_version} \ |
| 45 | && ./configure --prefix=/usr/local \ |
| 46 | && makescip-shell system . . make. \ |
| 47 | && makescip-shell system . . make. install \ |
| 48 | && cd .. |
| 49 | |
| 50 | # Requires autoconf 2.65+ |
| 51 | echoscip-shell system . . echo. "Installing automake ${automake_version}" |
| 52 | curlscip-shell system . . curl. -L http://ftp.gnu.org/gnu/automake/automake-${automake_version}.tar.xz > automake-${automake_version}.tar.xz \ |
| 53 | && tarscip-shell system . . tar. xJf automake-${automake_version}.tar.xz \ |
| 54 | && cd automake-${automake_version} \ |
| 55 | && ./configure --prefix=/usr/local \ |
| 56 | && makescip-shell system . . make. \ |
| 57 | && makescip-shell system . . make. install \ |
| 58 | && cd .. |
| 59 | |
| 60 | echoscip-shell system . . echo. "Installing libtool ${libtool_version}" |
| 61 | curlscip-shell system . . curl. -L http://ftp.gnu.org/gnu/libtool/libtool-${libtool_version}.tar.xz > libtool-${libtool_version}.tar.xz \ |
| 62 | && tarscip-shell system . . tar. xJf libtool-${libtool_version}.tar.xz \ |
| 63 | && cd libtool-${libtool_version} \ |
| 64 | && ./configure --prefix=/usr/local \ |
| 65 | && makescip-shell system . . make. \ |
| 66 | && makescip-shell system . . make. install \ |
| 67 | && cd .. |
| 68 | |
| 69 | echoscip-shell system . . echo. "Installing pkg-config ${pkgconf_version}" |
| 70 | curlscip-shell system . . curl. -L https://pkg-config.freedesktop.org/releases/pkg-config-${pkgconf_version}.tar.gz > pkg-config-${pkgconf_version}.tar.gz \ |
| 71 | && tarscip-shell system . . tar. xzf pkg-config-${pkgconf_version}.tar.gz \ |
| 72 | && cd pkg-config-${pkgconf_version} \ |
| 73 | && ./configure --prefix=/usr/local --libdir=/usr/lib64 \ |
| 74 | && makescip-shell system . . make. \ |
| 75 | && makescip-shell system . . make. install \ |
| 76 | && cd .. |
| 77 | |
| 78 | echoscip-shell system . . echo. 'Done' |