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