1 #!/usr/bin/bash
   2 #
   3 # CDDL HEADER START
   4 #
   5 # The contents of this file are subject to the terms of the
   6 # Common Development and Distribution License, Version 1.0 only
   7 # (the "License").  You may not use this file except in compliance
   8 # with the License.
   9 #
  10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  11 # or http://www.opensolaris.org/os/licensing.
  12 # See the License for the specific language governing permissions
  13 # and limitations under the License.
  14 #
  15 # When distributing Covered Code, include this CDDL HEADER in each
  16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  17 # If applicable, add the following below this CDDL HEADER, with the
  18 # fields enclosed by brackets "[]" replaced with your own identifying
  19 # information: Portions Copyright [yyyy] [name of copyright owner]
  20 #
  21 # CDDL HEADER END
  22 #
  23 #
  24 # Copyright 2011-2012 OmniTI Computer Consulting, Inc.  All rights reserved.
  25 # Use is subject to license terms.
  26 #
  27 # Load support functions
  28 . ../../lib/functions.sh
  29 
  30 PROG=gawk
  31 VER=4.1.1
  32 VERHUMAN=$VER
  33 PKG=text/gawk
  34 SUMMARY="gawk - GNU implementation of awk"
  35 DESC="$SUMMARY"
  36 
  37 BUILDARCH=32
  38 CONFIGURE_OPTS_32="$CONFIGURE_OPTS_32 --bindir=/usr/bin"
  39 
  40 # as of 4.1, gawk now supports arbitrary precision numbers.
  41 # build in MPFR/GMP support rather than dynamically linking it.
  42 save_function configure32 configure32_orig
  43 configure32() {
  44     configure32_orig
  45 
  46     logmsg "Patching Makefile to make mpfr/gmp static"
  47     pushd $TMPDIR/$BUILDDIR > /dev/null
  48     logcmd gsed -i -e 's#-lmpfr -lgmp#/opt/gcc-4.8.1/lib/libmpfr.a /opt/gcc-4.8.1/lib/libgmp.a#' Makefile
  49     popd > /dev/null
  50 }
  51 
  52 gnu_cleanup() {
  53     logmsg "Cleaning up install root"
  54     logcmd mkdir -p $DESTDIR/usr/gnu/bin
  55     logcmd mkdir -p $DESTDIR/usr/gnu/share/man/man1
  56     logcmd ln -s ../../bin/gawk $DESTDIR/usr/gnu/bin/awk
  57     logcmd ln -s ../../../../share/man/man1/gawk.1 $DESTDIR/usr/gnu/share/man/man1/awk.1
  58     logcmd rm -f $DESTDIR/usr/bin/awk || logerr "--- Unable to clean up $DESTDIR/usr/bin"
  59     logcmd rm -rf $DESTDIR/usr/libexec || logerr "--- unable to clean up libexec dir"
  60 }
  61 init
  62 download_source $PROG $PROG $VER
  63 patch_source
  64 prep_build
  65 build
  66 gnu_cleanup
  67 make_isa_stub
  68 make_package
  69 clean_up
  70 
  71 # Vim hints
  72 # vim:ts=4:sw=4:et: