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 # Use old gcc4 standards level for this.
  40 CFLAGS="$CFLAGS -std=gnu89"
  41 
  42 # as of 4.1, gawk now supports arbitrary precision numbers.
  43 # build in MPFR/GMP support rather than dynamically linking it.
  44 save_function configure32 configure32_orig
  45 configure32() {
  46     configure32_orig
  47 
  48     logmsg "Patching Makefile to make mpfr/gmp static"
  49     pushd $TMPDIR/$BUILDDIR > /dev/null
  50     logcmd gsed -i -e 's#-lmpfr -lgmp#/opt/gcc-5.1.0/lib/libmpfr.a /opt/gcc-5.1.0/lib/libgmp.a#' Makefile
  51     popd > /dev/null
  52 }
  53 
  54 gnu_cleanup() {
  55     logmsg "Cleaning up install root"
  56     logcmd mkdir -p $DESTDIR/usr/gnu/bin
  57     logcmd mkdir -p $DESTDIR/usr/gnu/share/man/man1
  58     logcmd ln -s ../../bin/gawk $DESTDIR/usr/gnu/bin/awk
  59     logcmd ln -s ../../../../share/man/man1/gawk.1 $DESTDIR/usr/gnu/share/man/man1/awk.1
  60     logcmd rm -f $DESTDIR/usr/bin/awk || logerr "--- Unable to clean up $DESTDIR/usr/bin"
  61     logcmd rm -rf $DESTDIR/usr/libexec || logerr "--- unable to clean up libexec dir"
  62 }
  63 init
  64 download_source $PROG $PROG $VER
  65 patch_source
  66 prep_build
  67 build
  68 gnu_cleanup
  69 make_isa_stub
  70 make_package
  71 clean_up
  72 
  73 # Vim hints
  74 # vim:ts=4:sw=4:et: