Ticket #57: haskell-platform-2009.2.0.2-optional-packages.patch

File haskell-platform-2009.2.0.2-optional-packages.patch, 6.5 kB (added by j3h, 4 years ago)

Patch to add --enable-opengl and --enable-editline flags to haskell-platform-2009.2.0.2

  • configure.ac

    diff --git a/configure.ac b/configure.ac
    index 9b420bb..b47c185 100644
    a b  
    9393  [ENABLE_PROFILING=YES] 
    9494) 
    9595 
     96AC_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 
     114AC_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) 
    96131 
    97132AC_ARG_ENABLE(unsupported-ghc-version, 
    98133[AC_HELP_STRING([--enable-unsupported-ghc-version], 
     
    208243 
    209244 
    210245# Check for OpenGL and GLUT 
    211 if test "$OSX" != "yes"; then 
     246if test \( "$OSX" != "yes" \) -a \( "$ENABLE_OPENGL" == "YES" \); then 
    212247  AC_CHECK_HEADER([GL/gl.h], [], 
    213248    [AC_MSG_ERROR(The OpenGL C library is required)]) 
    214249  AC_SEARCH_LIBS([glEnd], [GL opengl32], [], 
     
    225260    [AC_MSG_ERROR(The GLUT C library is required)]) 
    226261fi 
    227262 
    228  
    229263AC_SUBST([GHC]) 
    230264AC_SUBST([GHC_PKG]) 
    231265AC_SUBST([HSC2HS]) 
     
    233267 
    234268AC_SUBST([USER_INSTALL]) 
    235269AC_SUBST([ENABLE_PROFILING]) 
     270AC_SUBST([ENABLE_OPENGL]) 
     271AC_SUBST([ENABLE_EDITLINE]) 
    236272AC_SUBST([ALLOW_UNSUPPORTED_GHC]) 
    237273 
    238274AC_OUTPUT 
     
    250286echo '*   If you wish to change these settings then     ' 
    251287echo '*   use --prefix= and/or --enable-user-install    ' 
    252288echo '*                                                 ' 
     289if test "${ENABLE_EDITLINE}" != "YES"; then 
     290echo '*   editline will NOT be built                      ' 
     291echo '*                                                 ' 
     292echo '*   You will not get a haskell-platform package   ' 
     293echo '*   because some compliant codebases will not     ' 
     294echo '*   build.                                        ' 
     295echo '*                                                 ' 
     296fi 
     297if test "${ENABLE_OPENGL}" != "YES"; then 
     298echo '*   OpenGL will NOT be built                      ' 
     299echo '*                                                 ' 
     300echo '*   You will not get a haskell-platform package   ' 
     301echo '*   because some compliant codebases will not     ' 
     302echo '*   build.                                        ' 
     303echo '*                                                 ' 
     304fi 
    253305if test "${USER_INSTALL}" = "YES"; then 
    254306echo '* Now do "make" followed by "make install"        ' 
    255307else 
  • scripts/build.sh

    diff --git a/scripts/build.sh b/scripts/build.sh
    index 534b7e0..398589f 100755
    a b  
    1616  || die "Please run ./configure first" 
    1717 
    1818. scripts/config 
     19. scripts/common.sh 
    1920 
    2021# also check GHC, GHC_PKG 
    2122[ -n "$prefix" ] \ 
     
    4344[ -f "${PACKAGE_DB}" ] && rm "${PACKAGE_DB}" 
    4445echo '[]' > "${PACKAGE_DB}" 
    4546 
    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  
    6247build_pkg () { 
    6348  PKG=$1 
    6449 
     
    10287  cd .. 
    10388} 
    10489 
    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  
    11190# Actually do something! 
    11291 
    11392cd packages 
    11493for 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 
    11697    echo "Platform package ${pkg} is already installed. Skipping..." 
    11798  else 
    118     echo "Building ${PKG}" 
     99    echo "Building ${pkg}" 
    119100    build_pkg "${pkg}" 
    120101  fi 
    121102done 
  • (a) /dev/null vs. (b) b/scripts/common.sh

    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. 
     4tell() { 
     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? 
     20is_pkg_installed () { 
     21  PKG_VER=$1 
     22  grep " ${PKG_VER} " packages/installed.packages > /dev/null 2>&1 
     23} 
     24 
     25pkg_base () { 
     26  echo "$1" | sed 's/-[.0-9]\+$//' 
     27} 
     28 
     29skip_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} 
  • scripts/config.in

    diff --git a/scripts/config.in b/scripts/config.in
    index 6eeb798..0876ab6 100644
    a b  
    1717ALLOW_UNSUPPORTED_GHC=@ALLOW_UNSUPPORTED_GHC@ 
    1818USER_INSTALL=@USER_INSTALL@ 
    1919ENABLE_PROFILING=@ENABLE_PROFILING@ 
     20ENABLE_OPENGL=@ENABLE_OPENGL@ 
     21ENABLE_EDITLINE=@ENABLE_EDITLINE@ 
  • scripts/install.sh

    diff --git a/scripts/install.sh b/scripts/install.sh
    index 696befe..3bf1558 100755
    a b  
    1111  || die "Please run ./configure first" 
    1212 
    1313. scripts/config 
     14. scripts/common.sh 
    1415 
    1516install_pkg () { 
    1617  PKG=$1 
     
    3738# Actually do something! 
    3839cd packages 
    3940for 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 
    4451done 
    4552 
    4653echo