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 2014 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=nss
  31 VER=3.19
  32 # Include NSPR version since we're downloading a combined tarball.
  33 NSPRVER=4.10.8
  34 # But set BUILDDIR to just be the NSS version.
  35 BUILDDIR=$PROG-$VER
  36 VERHUMAN=$VER
  37 PKG=$PROG ##IGNORE##
  38 SUMMARY="Not the real summary"
  39 DESC="$SUMMARY"
  40 
  41 # NOTE: These are generated by uname and build variables.
  42 # CHECK THESE WHEN THINGS CHANGE!
  43 DIST32=SunOS5.11_i86pc_gcc_OPT.OBJ
  44 DIST64=SunOS5.11_i86pc_gcc_64_OPT.OBJ
  45 
  46 BUILD_DEPENDS_IPS="library/nspr/header-nspr"
  47 
  48 MAKE_OPTS="BUILD_OPT=1 NS_USE_GCC=1 NO_MDUPDATE=1 NSDISTMODE=copy"
  49 
  50 NSS_LIBS="libfreebl3.so libnss3.so
  51         libnssckbi.so libnssdbm3.so
  52         libnssutil3.so libsmime3.so
  53         libsoftokn3.so libssl3.so"
  54 NSPR_LIBS="libnspr4.so libplc4.so libplds4.so"
  55 
  56 # Use old gcc4 standards level for this.
  57 export OS_CFLAGS="-std=gnu89"
  58 
  59 # Variables that switch between NSS and NSPR
  60 TGT_LIBS=$NSS_LIBS
  61 PC_FILE=nss.pc
  62 LOCAL_MOG_FILE=nss-local.mog
  63 
  64 make_clean() {
  65     # Assume PWD == top-level with nss & nspr subdirs.
  66     /bin/rm -rf dist
  67     cd nss
  68     logcmd gmake $MAKE_OPTS nss_clean_all || logerr "Can't make clean"
  69     cd ..
  70 }
  71 
  72 configure32() {
  73     # Get the install/prototype path out of the way now.
  74     logcmd mkdir -p $DESTDIR/usr/lib/mps || \
  75         logerr "Failed to create NSS install directory."
  76 }
  77 
  78 make_prog32() {
  79     logmsg "Making libraries (32)"
  80     # Assume PWD == top-level with nss & nspr subdirs.
  81     cd nss
  82     logcmd gmake $MAKE_OPTS nss_build_all || logerr "build failed"
  83     cd ..
  84 }
  85 make_install32() {
  86     logmsg "Installing libraries (32)"
  87     for lib in $TGT_LIBS
  88     do
  89         logcmd cp $TMPDIR/$BUILDDIR/dist/$DIST32/lib/$lib \
  90             $DESTDIR/usr/lib/mps/$lib
  91     done
  92     logmsg "Installing headers"
  93     logcmd mkdir -p $DESTDIR/usr/include/mps || \
  94         logerr "Failed to create NSS header install directory."
  95     logcmd cp $TMPDIR/$BUILDDIR/dist/public/nss/* $DESTDIR/usr/include/mps/
  96     logcmd cp $TMPDIR/$BUILDDIR/dist/public/dbm/* $DESTDIR/usr/include/mps/
  97 
  98     # Save 32-bit NSPR dist off for NSPR build.
  99     mkdir /tmp/nspr-save.$$
 100     for lib in $NSPR_LIBS
 101     do
 102         logcmd cp $TMPDIR/$BUILDDIR/dist/$DIST32/lib/$lib /tmp/nspr-save.$$
 103     done
 104     cp $TMPDIR/$BUILDDIR/nspr/$DIST32/config/nspr.pc /tmp/nspr-save.$$
 105 }
 106 
 107 configure64() {
 108     # Get the install/prototype path out of the way now.
 109     logcmd mkdir -p $DESTDIR/usr/lib/mps/amd64 || \
 110         logerr "Failed to create NSS install directory."
 111 }
 112 
 113 make_prog64() {
 114     logmsg "Making libraries (64)"
 115     # Assume PWD == top-level with nss & nspr subdirs.
 116     cd nss
 117     logcmd gmake $MAKE_OPTS USE_64=1 nss_build_all || logerr "build failed"
 118     cd ..
 119 }
 120 make_install64() {
 121     logmsg "Installing libraries (64)"
 122     for lib in $TGT_LIBS
 123     do
 124         logcmd cp $TMPDIR/$BUILDDIR/dist/$DIST64/lib/$lib \
 125             $DESTDIR/usr/lib/mps/amd64/$lib
 126     done
 127 }
 128 secv1_links() {
 129     logcmd ln -s amd64 $DESTDIR/usr/lib/mps/64
 130     logcmd mkdir -p $DESTDIR/usr/lib/mps/secv1/amd64
 131     logcmd ln -s amd64 $DESTDIR/usr/lib/mps/secv1/64
 132     logcmd mkdir -p $DESTDIR/usr/lib/pkgconfig
 133     logcmd cp $SRCDIR/files/$PC_FILE $DESTDIR/usr/lib/pkgconfig
 134     for lib in $TGT_LIBS
 135     do
 136         ln -s ../../amd64/$lib $DESTDIR/usr/lib/mps/secv1/amd64/$lib
 137         ln -s ../$lib $DESTDIR/usr/lib/mps/secv1/$lib
 138     done
 139 }
 140 
 141 init
 142 # Download combined NSS & NSPR tarball.
 143 download_source $PROG $PROG "$VER-with-nspr-$NSPRVER"
 144 patch_source
 145 prep_build
 146 build
 147 secv1_links
 148 
 149 PKG=system/library/mozilla-nss/header-nss
 150 SUMMARY="Network Security Services Headers"
 151 DESC="$SUMMARY"
 152 make_package header-nss.mog
 153 
 154 DEPENDS_IPS="SUNWcs system/library/gcc-5-runtime system/library
 155         library/nspr database/sqlite-3"
 156 PKG=system/library/mozilla-nss
 157 SUMMARY="Network Security Services Libraries"
 158 DESC="$SUMMARY"
 159 make_package nss.mog
 160 
 161 # This cleans up NSS.
 162 clean_up
 163 
 164 # Switch variables & populate other proto area.
 165 VER=$NSPRVER
 166 TGT_LIBS=$NSPR_LIBS
 167 PC_FILE=nspr.pc
 168 LOCAL_MOG_FILE=nspr-local.mog
 169 DESTDIR=`echo $DESTDIR | sed 's/nss/nspr/g'`
 170 prep_build
 171 logcmd mkdir -p $DESTDIR/usr/include/mps/md || \
 172     logerr "Failed to create NSPR header install directory."
 173 logcmd mkdir -p $DESTDIR/usr/include/mps/obsolete || \
 174     logerr "Failed to create NSPR header install directory."
 175 logcmd mkdir -p $DESTDIR/usr/include/mps/private || \
 176     logerr "Failed to create NSPR header install directory."
 177 logcmd mkdir -p $DESTDIR/usr/lib/mps/amd64 || \
 178     logerr "Failed to create NSPR install directory."
 179 logcmd mkdir -p $DESTDIR/usr/lib/mps/pkgconfig || \
 180     logerr "Failed to create NSPR install directory."
 181 logcmd mkdir -p $DESTDIR/usr/lib/mps/amd64/pkgconfig || \
 182     logerr "Failed to create NSPR install directory."
 183 logcmd mkdir -p $DESTDIR/usr/include/mps/pkgconfig || \
 184     logerr "Failed to create NSPR header install directory."
 185 
 186 make_install64
 187 logcmd cp $TMPDIR/$BUILDDIR/dist/$DIST64/include/*.h $DESTDIR/usr/include/mps
 188 logcmd cp $TMPDIR/$BUILDDIR/dist/$DIST64/include/obsolete/*.h \
 189     $DESTDIR/usr/include/mps/obsolete
 190 logcmd cp $TMPDIR/$BUILDDIR/dist/$DIST64/include/private/*.h \
 191     $DESTDIR/usr/include/mps/private
 192 logcmd cp $TMPDIR/$BUILDDIR/dist/$DIST64/include/md/* \
 193     $DESTDIR/usr/include/mps/md
 194 logcmd cp $TMPDIR/$BUILDDIR/nspr/$DIST64/config/nspr.pc \
 195     $DESTDIR/usr/lib/mps/amd64/pkgconfig
 196 # Restore 32-bit NSPR libraries.
 197 logcmd cp /tmp/nspr-save.$$/nspr.pc $DESTDIR/usr/lib/mps/pkgconfig/nspr.pc
 198 logcmd cp /tmp/nspr-save.$$/*.so $DESTDIR/usr/lib/mps || \
 199     logerr "32-bit NSPR library installation failure"
 200 logcmd rm -rf /tmp/nspr-save.$$
 201 secv1_links
 202 
 203 PKG=library/nspr/header-nspr
 204 SUMMARY="Netscape Portable Runtime Headers"
 205 DESC="$SUMMARY"
 206 make_package header-nspr.mog
 207 
 208 DEPENDS_IPS="SUNWcs system/library/gcc-5-runtime system/library"
 209 PKG=library/nspr
 210 SUMMARY="Netscape Portable Runtime"
 211 DESC="$SUMMARY"
 212 make_package nspr.mog
 213 
 214 # This cleans up NSPR.
 215 clean_up
 216 
 217 # Vim hints
 218 # vim:ts=4:sw=4:et: