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