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=p7zip
31 VER=9.20.1
32 VERHUMAN=$VER
33 PKG=compress/p7zip
34 SUMMARY="The p7zip compression and archiving utility"
35 DESC="$SUMMARY"
36
37 SRCVER="${VER}_src_all"
38 BUILDDIR=${PROG}_${VER}
39 BUILDARCH=32
40
41 DEPENDS_IPS="system/library/g++-4-runtime system/library/gcc-4-runtime shell/bash"
42
43 configure32() {
44 DEST_HOME=$PREFIX
45 DEST_SHARE_DOC=$DEST_HOME/share/doc/p7zip
46 DEST_MAN=$DEST_HOME/share/man
47 export DEST_HOME DEST_BIN DEST_SHARE DEST_SHARE_DOC DEST_MAN
48 }
49
50 make_prog() {
51 [[ -n $NO_PARALLEL_MAKE ]] && MAKE_JOBS=""
52
53 logmsg "Making 64 bit version"
54 logcmd $MAKE $MAKE_JOBS OPTFLAGS="-D_LARGEFILE64_SOURCE -m64" all3 || \
55 logerr "--- 64bit make failed"
56
57 DEST_BIN=$DEST_HOME/bin/$ISAPART64
58 DEST_SHARE=$DEST_HOME/lib/amd64
59 export DEST_BIN DEST_SHARE
60 logmsg "Installing 64 bit version"
61 logcmd $MAKE $MAKE_JOBS OPTFLAGS="-D_LARGEFILE64_SOURCE -m64" install DEST_DIR="$DESTDIR" || logerr "--- 64bit make install failed"
62
63 logmsg "--- make clean"
64 logcmd $MAKE clean
65
66 logmsg "Making 32 bit version"
67 logmsg "--- make"
68 logcmd $MAKE $MAKE_JOBS all3 || \
69 logerr "--- Make failed"
70
71 DEST_BIN=$DEST_HOME/bin/$ISAPART
72 DEST_SHARE=$DEST_HOME/lib
73 export DEST_BIN DEST_SHARE
74 logmsg "Installing 32 bit version"
75 logcmd $MAKE $MAKE_JOBS install DEST_DIR="$DESTDIR" || logerr "--- 32bit make install failed"
76 }
77
78 build32() {
79 pushd $TMPDIR/$BUILDDIR > /dev/null
80 logmsg "Building it all 32/64"
81 export ISALIST="$ISAPART"
82 make_clean
83 configure32
84 logcmd cp makefile.solaris_x86 makefile.machine
85 make_prog32
86 popd > /dev/null
87 unset ISALIST
88 export ISALIST
89 }
90
91 # Also include the shell wrapper for gzip-style compatibility
92 install_sh_wrapper() {
93 pushd $TMPDIR/$BUILDDIR/contrib/gzip-like_CLI_wrapper_for_7z/ > /dev/null
94 logmsg "Installing p7zip shell wrapper"
95 logcmd cp p7zip $DESTDIR/usr/bin/ || \
96 logerr "--- Failed: unable to copy p7zip script"
97 logcmd chmod 555 $DESTDIR/usr/bin/p7zip
98 logcmd cp man1/p7zip.1 $DESTDIR/$DEST_MAN/man1/ || \
99 logerr "--- Failed: unable to copy p7zip man page"
100 popd > /dev/null
101 }
102
103 init
104 download_source $PROG ${PROG}_${SRCVER}
105 patch_source
106 prep_build
107 build
108 install_sh_wrapper
109 make_isa_stub
110 make_package
111 chmod -R u+w $DESTDIR
112 clean_up
113
114 # Vim hints
115 # vim:ts=4:sw=4:et: