xref: /minix3/crypto/external/bsd/openssl/dist/shlib/hpux10-cc.sh (revision ebfedea0ce5bbe81e252ddf32d732e40fb633fae)
1*ebfedea0SLionel Sambuc#!/usr/bin/sh
2*ebfedea0SLionel Sambuc#
3*ebfedea0SLionel Sambuc# Run this script from the OpenSSL root directory:
4*ebfedea0SLionel Sambuc# sh shlib/hpux10-cc.sh
5*ebfedea0SLionel Sambuc#
6*ebfedea0SLionel Sambuc# HP-UX (10.20) shared library installation:
7*ebfedea0SLionel Sambuc# Compile and install OpenSSL with best possible optimization:
8*ebfedea0SLionel Sambuc# - shared libraries are compiled and installed with +O4 optimization
9*ebfedea0SLionel Sambuc# - executable(s) are compiled and installed with +O4 optimization
10*ebfedea0SLionel Sambuc# - static libraries are compiled and installed with +O3 optimization,
11*ebfedea0SLionel Sambuc#   to avoid the time consuming +O4 link-time optimization when using
12*ebfedea0SLionel Sambuc#   these libraries. (The shared libs are already optimized during build
13*ebfedea0SLionel Sambuc#   at +O4.)
14*ebfedea0SLionel Sambuc#
15*ebfedea0SLionel Sambuc# This script must be run with appropriate privileges to install into
16*ebfedea0SLionel Sambuc# /usr/local/ssl. HP-UX prevents used executables and shared libraries
17*ebfedea0SLionel Sambuc# from being deleted or overwritten. Stop all processes using already
18*ebfedea0SLionel Sambuc# installed items of OpenSSL.
19*ebfedea0SLionel Sambuc#
20*ebfedea0SLionel Sambuc# WARNING: At high optimization levels, HP's ANSI-C compiler can chew up
21*ebfedea0SLionel Sambuc#          large amounts of memory and CPU time. Make sure to have at least
22*ebfedea0SLionel Sambuc#          128MB of RAM available and that your kernel is configured to allow
23*ebfedea0SLionel Sambuc#          at least 128MB data size (maxdsiz parameter which can be obtained
24*ebfedea0SLionel Sambuc#          by multiplying 'echo maxdsiz/D | adb -k /stand/vmunix /dev/kmem'
25*ebfedea0SLionel Sambuc#          by 'getconf PAGE_SIZE').
26*ebfedea0SLionel Sambuc#          The installation process can take several hours, even on fast
27*ebfedea0SLionel Sambuc#          machines. +O4 optimization of the libcrypto.sl shared library may
28*ebfedea0SLionel Sambuc#          take 1 hour on a C200 (200MHz PA8200 CPU), +O3 compilation of
29*ebfedea0SLionel Sambuc#          fcrypt_b.c can take 20 minutes on this machine. Stay patient.
30*ebfedea0SLionel Sambuc#
31*ebfedea0SLionel Sambuc# SITEFLAGS: site specific flags. I do use +DAportable, since I have to
32*ebfedea0SLionel Sambuc# support older PA1.1-type CPUs. Your mileage may vary.
33*ebfedea0SLionel Sambuc# +w1 enables enhanced warnings, useful when working with snaphots.
34*ebfedea0SLionel Sambuc#
35*ebfedea0SLionel SambucSITEFLAGS="+DAportable +w1"
36*ebfedea0SLionel Sambuc#
37*ebfedea0SLionel Sambuc# Set the default additions to build with HP-UX.
38*ebfedea0SLionel Sambuc# -D_REENTRANT must/should be defined on HP-UX manually, since we do call
39*ebfedea0SLionel Sambuc# Configure directly.
40*ebfedea0SLionel Sambuc# +Oall increases the optimization done.
41*ebfedea0SLionel Sambuc#
42*ebfedea0SLionel SambucMYFLAGS="-D_REENTRANT +Oall $SITEFLAGS"
43*ebfedea0SLionel Sambuc
44*ebfedea0SLionel Sambuc# Configure for pic and build the static pic libraries
45*ebfedea0SLionel Sambucperl5 Configure no-shared hpux-parisc-cc-o4 +Z ${MYFLAGS}
46*ebfedea0SLionel Sambucmake clean
47*ebfedea0SLionel Sambucmake DIRS="crypto ssl"
48*ebfedea0SLionel Sambuc# Rename the static pic libs and build dynamic libraries from them
49*ebfedea0SLionel Sambuc# Be prepared to see a lot of warnings about shared libraries being built
50*ebfedea0SLionel Sambuc# with optimizations higher than +O2. When using these libraries, it is
51*ebfedea0SLionel Sambuc# not possible to replace internal library functions with functions from
52*ebfedea0SLionel Sambuc# the program to be linked.
53*ebfedea0SLionel Sambuc#
54*ebfedea0SLionel Sambucmake -f shlib/Makefile.hpux10-cc
55*ebfedea0SLionel Sambuc
56*ebfedea0SLionel Sambuc# Copy the libraries to /usr/local/ssl/lib (they have to be in their
57*ebfedea0SLionel Sambuc# final location when linking applications).
58*ebfedea0SLionel Sambuc# If the directories are still there, no problem.
59*ebfedea0SLionel Sambucmkdir /usr/local
60*ebfedea0SLionel Sambucmkdir /usr/local/ssl
61*ebfedea0SLionel Sambucmkdir /usr/local/ssl/lib
62*ebfedea0SLionel Sambucchmod 444 lib*_pic.a
63*ebfedea0SLionel Sambucchmod 555 lib*.sl.0.9.8
64*ebfedea0SLionel Sambuccp -p lib*_pic.a lib*.sl.0.9.8 /usr/local/ssl/lib
65*ebfedea0SLionel Sambuc(cd /usr/local/ssl/lib ; ln -sf libcrypto.sl.0.9.8 libcrypto.sl ; ln -sf libssl.sl.0.9.8 libssl.sl)
66*ebfedea0SLionel Sambuc
67*ebfedea0SLionel Sambuc# Reconfigure without pic to compile the executables. Unfortunately, while
68*ebfedea0SLionel Sambuc# performing this task we have to recompile the library components, even
69*ebfedea0SLionel Sambuc# though we use the already installed shared libs anyway.
70*ebfedea0SLionel Sambuc#
71*ebfedea0SLionel Sambucperl5 Configure no-shared hpux-parisc-cc-o4 ${MYFLAGS}
72*ebfedea0SLionel Sambuc
73*ebfedea0SLionel Sambucmake clean
74*ebfedea0SLionel Sambuc
75*ebfedea0SLionel Sambuc# Hack the Makefiles to pick up the dynamic libraries during linking
76*ebfedea0SLionel Sambuc#
77*ebfedea0SLionel Sambucsed 's/^PEX_LIBS=.*$/PEX_LIBS=-L\/usr\/local\/ssl\/lib/' Makefile.ssl >xxx; mv xxx Makefile.ssl
78*ebfedea0SLionel Sambucsed 's/-L\.\.//' apps/Makefile.ssl >xxx; mv xxx apps/Makefile.ssl
79*ebfedea0SLionel Sambucsed 's/-L\.\.//' test/Makefile.ssl >xxx; mv xxx test/Makefile.ssl
80*ebfedea0SLionel Sambuc# Build the static libs and the executables in one make.
81*ebfedea0SLionel Sambucmake
82*ebfedea0SLionel Sambuc# Install everything
83*ebfedea0SLionel Sambucmake install
84*ebfedea0SLionel Sambuc
85*ebfedea0SLionel Sambuc# Finally build the static libs with +O3. This time we only need the libraries,
86*ebfedea0SLionel Sambuc# once created, they are simply copied into place.
87*ebfedea0SLionel Sambuc#
88*ebfedea0SLionel Sambucperl5 Configure no-shared hpux-parisc-cc ${MYFLAGS}
89*ebfedea0SLionel Sambucmake clean
90*ebfedea0SLionel Sambucmake DIRS="crypto ssl"
91*ebfedea0SLionel Sambucchmod 644 libcrypto.a libssl.a
92*ebfedea0SLionel Sambuccp -p libcrypto.a libssl.a /usr/local/ssl/lib
93