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