Advertisement
Guest User

nsf/build.sh

a guest
May 2nd, 2015
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.00 KB | None | 0 0
  1. #! /usr/bin/env bash
  2.  
  3. if [ ! -f 'build.sh' ]; then
  4.     echo 'ERROR: This script must be run from the directory it is in' >&2
  5.    
  6.     exit 1
  7. fi
  8. if [ -z "${TCLVERS}" ]; then
  9.     echo 'ERROR: The TCLVERS environment variable is not set' >&2
  10.    
  11.     exit 1
  12. fi
  13.  
  14. NSFVERS="2.0.0"
  15. NSFVERSEXTRA=""
  16. SRC="src/nsf${NSFVERS}.tar.gz"
  17. SRCURL="http://sourceforge.net/projects/next-scripting/files/${NSFVERS}/nsf${NSFVERS}.tar.gz/download"
  18. BUILDDIR="$(pwd)/build/nsf${NSFVERS}"
  19. OUTDIR="$(pwd)/out"
  20. INSTDIR="$(pwd)/inst"
  21. export NSFVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR
  22.  
  23. # Set configure options for this sub-project
  24. LDFLAGS="${LDFLAGS} ${KC_NSF_LDFLAGS}"
  25. CFLAGS="${CFLAGS} ${KC_NSF_CFLAGS}"
  26. CPPFLAGS="${CPPFLAGS} ${KC_NSF_CPPFLAGS}"
  27. LIBS="${LIBS} ${KC_NSF_LIBS}"
  28. export LDFLAGS CFLAGS CPPFLAGS LIBS
  29.  
  30. rm -rf 'build' 'out' 'inst'
  31. mkdir 'build' 'out' 'inst' || exit 1
  32.  
  33. if [ ! -f "${SRC}" ]; then
  34.     mkdir 'src' >/dev/null 2>/dev/null
  35.    
  36.     if [ ! -d 'buildsrc' ]; then
  37.     rm -f "${SRC}.tmp"
  38.     wget -O "${SRC}.tmp" "${SRCURL}" || exit 1
  39.     mv "${SRC}.tmp" "${SRC}"
  40.     fi
  41. fi
  42.  
  43. (
  44.     cd 'build' || exit 1
  45.    
  46.     if [ ! -d '../buildsrc' ]; then
  47.     gzip -dc "../${SRC}" | tar -xf -
  48.     else    
  49.     cp -rp ../buildsrc/* './'
  50.     fi
  51.    
  52.     cd "${BUILDDIR}" || exit 1
  53.    
  54.     # Build
  55.     echo "Running: ./configure --enable-shared --disable-symbols --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" --with-tcl=\"${TCLCONFIGDIR}\" ${CONFIGUREEXTRA}"
  56.     ./configure --enable-shared --disable-symbols --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" --with-tcl="${TCLCONFIGDIR}" ${CONFIGUREEXTRA}
  57.    
  58.     echo "Running: ${MAKE:-make}"
  59.     ${MAKE:-make} || exit 1
  60.    
  61.     echo "Running: ${MAKE:-make} install"
  62.     ${MAKE:-make} install
  63.    
  64.     mkdir "${OUTDIR}/lib" || exit 1
  65.     cp -r "${INSTDIR}/lib"/nsf* "${OUTDIR}/lib/"
  66.    
  67.     "${STRIP:-strip}" -g "${OUTDIR}"/lib/nsf*/*.so >/dev/null 2>/dev/null
  68.    
  69.     exit 0
  70. ) || exit 1
  71.  
  72. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement