diff --git a/configure.ac b/configure.ac
index 9b420bb..b47c185 100644
|
a
|
b
|
|
| 93 | 93 | [ENABLE_PROFILING=YES] |
| 94 | 94 | ) |
| 95 | 95 | |
| | 96 | AC_ARG_ENABLE(opengl, |
| | 97 | [AC_HELP_STRING([--enable-opengl], |
| | 98 | [Enable building of OpenGL packages. (default=enable)])], |
| | 99 | [case "${enableval}" in |
| | 100 | yes) |
| | 101 | ENABLE_OPENGL=YES |
| | 102 | ;; |
| | 103 | no) |
| | 104 | ENABLE_OPENGL=NO |
| | 105 | ;; |
| | 106 | *) |
| | 107 | AC_MSG_ERROR([The --enable-opengl value should be "yes" or "no"]) |
| | 108 | ;; |
| | 109 | esac |
| | 110 | ], |
| | 111 | [ENABLE_OPENGL=YES] |
| | 112 | ) |
| | 113 | |
| | 114 | AC_ARG_ENABLE(editline, |
| | 115 | [AC_HELP_STRING([--enable-editline], |
| | 116 | [Enable building of the editline package. (default=enable)])], |
| | 117 | [case "${enableval}" in |
| | 118 | yes) |
| | 119 | ENABLE_EDITLINE=YES |
| | 120 | ;; |
| | 121 | no) |
| | 122 | ENABLE_EDITLINE=NO |
| | 123 | ;; |
| | 124 | *) |
| | 125 | AC_MSG_ERROR([The --enable-editline value should be "yes" or "no"]) |
| | 126 | ;; |
| | 127 | esac |
| | 128 | ], |
| | 129 | [ENABLE_EDITLINE=YES] |
| | 130 | ) |
| 96 | 131 | |
| 97 | 132 | AC_ARG_ENABLE(unsupported-ghc-version, |
| 98 | 133 | [AC_HELP_STRING([--enable-unsupported-ghc-version], |
| … |
… |
|
| 208 | 243 | |
| 209 | 244 | |
| 210 | 245 | # Check for OpenGL and GLUT |
| 211 | | if test "$OSX" != "yes"; then |
| | 246 | if test \( "$OSX" != "yes" \) -a \( "$ENABLE_OPENGL" == "YES" \); then |
| 212 | 247 | AC_CHECK_HEADER([GL/gl.h], [], |
| 213 | 248 | [AC_MSG_ERROR(The OpenGL C library is required)]) |
| 214 | 249 | AC_SEARCH_LIBS([glEnd], [GL opengl32], [], |
| … |
… |
|
| 225 | 260 | [AC_MSG_ERROR(The GLUT C library is required)]) |
| 226 | 261 | fi |
| 227 | 262 | |
| 228 | | |
| 229 | 263 | AC_SUBST([GHC]) |
| 230 | 264 | AC_SUBST([GHC_PKG]) |
| 231 | 265 | AC_SUBST([HSC2HS]) |
| … |
… |
|
| 233 | 267 | |
| 234 | 268 | AC_SUBST([USER_INSTALL]) |
| 235 | 269 | AC_SUBST([ENABLE_PROFILING]) |
| | 270 | AC_SUBST([ENABLE_OPENGL]) |
| | 271 | AC_SUBST([ENABLE_EDITLINE]) |
| 236 | 272 | AC_SUBST([ALLOW_UNSUPPORTED_GHC]) |
| 237 | 273 | |
| 238 | 274 | AC_OUTPUT |
| … |
… |
|
| 250 | 286 | echo '* If you wish to change these settings then ' |
| 251 | 287 | echo '* use --prefix= and/or --enable-user-install ' |
| 252 | 288 | echo '* ' |
| | 289 | if test "${ENABLE_EDITLINE}" != "YES"; then |
| | 290 | echo '* editline will NOT be built ' |
| | 291 | echo '* ' |
| | 292 | echo '* You will not get a haskell-platform package ' |
| | 293 | echo '* because some compliant codebases will not ' |
| | 294 | echo '* build. ' |
| | 295 | echo '* ' |
| | 296 | fi |
| | 297 | if test "${ENABLE_OPENGL}" != "YES"; then |
| | 298 | echo '* OpenGL will NOT be built ' |
| | 299 | echo '* ' |
| | 300 | echo '* You will not get a haskell-platform package ' |
| | 301 | echo '* because some compliant codebases will not ' |
| | 302 | echo '* build. ' |
| | 303 | echo '* ' |
| | 304 | fi |
| 253 | 305 | if test "${USER_INSTALL}" = "YES"; then |
| 254 | 306 | echo '* Now do "make" followed by "make install" ' |
| 255 | 307 | else |
diff --git a/scripts/build.sh b/scripts/build.sh
index 534b7e0..398589f 100755
|
a
|
b
|
|
| 16 | 16 | || die "Please run ./configure first" |
| 17 | 17 | |
| 18 | 18 | . scripts/config |
| | 19 | . scripts/common.sh |
| 19 | 20 | |
| 20 | 21 | # also check GHC, GHC_PKG |
| 21 | 22 | [ -n "$prefix" ] \ |
| … |
… |
|
| 43 | 44 | [ -f "${PACKAGE_DB}" ] && rm "${PACKAGE_DB}" |
| 44 | 45 | echo '[]' > "${PACKAGE_DB}" |
| 45 | 46 | |
| 46 | | # Maybe use a small script instead ? Tested with bash and zsh. |
| 47 | | tell() { |
| 48 | | # Save and shift the executable name |
| 49 | | CMD=$1 |
| 50 | | shift |
| 51 | | # Build the string of command-line parameters |
| 52 | | PRINT="\"${CMD}\"" |
| 53 | | for arg in "$@"; do |
| 54 | | PRINT="${PRINT} \"${arg}\"" |
| 55 | | done |
| 56 | | # Echo the command |
| 57 | | echo `echo $PRINT` |
| 58 | | # Run the command |
| 59 | | "$CMD" "$@" |
| 60 | | } |
| 61 | | |
| 62 | 47 | build_pkg () { |
| 63 | 48 | PKG=$1 |
| 64 | 49 | |
| … |
… |
|
| 102 | 87 | cd .. |
| 103 | 88 | } |
| 104 | 89 | |
| 105 | | # Is this exact version of the package already installed? |
| 106 | | is_pkg_installed () { |
| 107 | | PKG_VER=$1 |
| 108 | | grep " ${PKG_VER} " installed.packages > /dev/null 2>&1 |
| 109 | | } |
| 110 | | |
| 111 | 90 | # Actually do something! |
| 112 | 91 | |
| 113 | 92 | cd packages |
| 114 | 93 | for pkg in `cat platform.packages`; do |
| 115 | | if is_pkg_installed "${pkg}"; then |
| | 94 | if skip_pkg "${pkg}"; then |
| | 95 | echo "Skipping ${pkg} due to configuration" |
| | 96 | elif is_pkg_installed "${pkg}"; then |
| 116 | 97 | echo "Platform package ${pkg} is already installed. Skipping..." |
| 117 | 98 | else |
| 118 | | echo "Building ${PKG}" |
| | 99 | echo "Building ${pkg}" |
| 119 | 100 | build_pkg "${pkg}" |
| 120 | 101 | fi |
| 121 | 102 | done |
diff --git a/scripts/common.sh b/scripts/common.sh
new file mode 100755
index 0000000..8d3f7a2
|
a
|
b
|
|
| | 1 | # Just a bunch of sh functions use in build.sh and install.sh |
| | 2 | |
| | 3 | # Maybe use a small script instead ? Tested with bash and zsh. |
| | 4 | tell() { |
| | 5 | # Save and shift the executable name |
| | 6 | CMD=$1 |
| | 7 | shift |
| | 8 | # Build the string of command-line parameters |
| | 9 | PRINT="\"${CMD}\"" |
| | 10 | for arg in "$@"; do |
| | 11 | PRINT="${PRINT} \"${arg}\"" |
| | 12 | done |
| | 13 | # Echo the command |
| | 14 | echo `echo $PRINT` |
| | 15 | # Run the command |
| | 16 | "$CMD" "$@" |
| | 17 | } |
| | 18 | |
| | 19 | # Is this exact version of the package already installed? |
| | 20 | is_pkg_installed () { |
| | 21 | PKG_VER=$1 |
| | 22 | grep " ${PKG_VER} " packages/installed.packages > /dev/null 2>&1 |
| | 23 | } |
| | 24 | |
| | 25 | pkg_base () { |
| | 26 | echo "$1" | sed 's/-[.0-9]\+$//' |
| | 27 | } |
| | 28 | |
| | 29 | skip_pkg() { |
| | 30 | case `pkg_base "$1"` in |
| | 31 | OpenGL|GLUT) |
| | 32 | test "$ENABLE_OPENGL" == "NO" |
| | 33 | ;; |
| | 34 | editline) |
| | 35 | test "$ENABLE_EDITLINE" == "NO" |
| | 36 | ;; |
| | 37 | haskell-platform) |
| | 38 | test \( "$ENABLE_OPENGL" == "NO" \) -o \( "$ENABLE_EDITLINE" == "NO" \) |
| | 39 | ;; |
| | 40 | *) |
| | 41 | false |
| | 42 | ;; |
| | 43 | esac |
| | 44 | } |
diff --git a/scripts/config.in b/scripts/config.in
index 6eeb798..0876ab6 100644
|
a
|
b
|
|
| 17 | 17 | ALLOW_UNSUPPORTED_GHC=@ALLOW_UNSUPPORTED_GHC@ |
| 18 | 18 | USER_INSTALL=@USER_INSTALL@ |
| 19 | 19 | ENABLE_PROFILING=@ENABLE_PROFILING@ |
| | 20 | ENABLE_OPENGL=@ENABLE_OPENGL@ |
| | 21 | ENABLE_EDITLINE=@ENABLE_EDITLINE@ |
diff --git a/scripts/install.sh b/scripts/install.sh
index 696befe..3bf1558 100755
|
a
|
b
|
|
| 11 | 11 | || die "Please run ./configure first" |
| 12 | 12 | |
| 13 | 13 | . scripts/config |
| | 14 | . scripts/common.sh |
| 14 | 15 | |
| 15 | 16 | install_pkg () { |
| 16 | 17 | PKG=$1 |
| … |
… |
|
| 37 | 38 | # Actually do something! |
| 38 | 39 | cd packages |
| 39 | 40 | for pkg in `cat platform.packages`; do |
| 40 | | cd "${pkg}" || die "The directory for the component ${PKG} is missing" |
| 41 | | echo "Installing ${pkg}..." |
| 42 | | install_pkg ${pkg} |
| 43 | | cd .. |
| | 41 | if skip_pkg "${pkg}"; then |
| | 42 | echo "Skipping ${pkg} due to configuration" |
| | 43 | elif is_pkg_installed "${pkg}"; then |
| | 44 | echo "Platform package ${pkg} is already installed. Skipping..." |
| | 45 | else |
| | 46 | cd "${pkg}" || die "The directory for the component ${PKG} is missing" |
| | 47 | echo "Installing ${pkg}..." |
| | 48 | install_pkg ${pkg} |
| | 49 | cd .. |
| | 50 | fi |
| 44 | 51 | done |
| 45 | 52 | |
| 46 | 53 | echo |