Andreas Wacknitz
2019-02-20 87aea72cefaa0f85220264ab8462c9a19caba0ef
commit | author | age
225938 1 #
AP 2 # CDDL HEADER START
3 #
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
7 #
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
12 #
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 #
19 # CDDL HEADER END
20 #
d4b669 21 # Copyright 2017 Gary Mills
211606 22 # Copyright 2018 Michal Nowak
225938 23 # Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
AP 24 #
e195e4 25 include ../../../../make-rules/shared-macros.mk
225938 26
AP 27 COMPONENT_NAME =    openssl
28 # When new version of OpenSSL comes in, you must update both COMPONENT_VERSION
29 # and IPS_COMPONENT_VERSION.
093dc0 30 COMPONENT_VERSION =    1.0.2q
225938 31 # Version for IPS. It is easier to do it manually than convert the letter to a
AP 32 # number while taking into account that there might be no letter at all.
093dc0 33 IPS_COMPONENT_VERSION = 1.0.2.17
87aea7 34 COMPONENT_REVISION =     1
211606 35 COMPONENT_PROJECT_URL=    https://www.openssl.org
225938 36 COMPONENT_SRC =        $(COMPONENT_NAME)-$(COMPONENT_VERSION)
AP 37 COMPONENT_ARCHIVE =    $(COMPONENT_SRC).tar.gz
38 COMPONENT_ARCHIVE_HASH=    \
093dc0 39     sha256:5744cfcbcec2b1b48629f7354203bc1e5e9b5466998bbccc5b5fcde3b18eb684
211606 40 COMPONENT_ARCHIVE_URL =    $(COMPONENT_PROJECT_URL)/source/$(COMPONENT_ARCHIVE)
225938 41 COMPONENT_BUGDB=    library/openssl
AP 42
43 TPNO=            24194
44
45 include $(WS_MAKE_RULES)/prep.mk
46 include $(WS_MAKE_RULES)/configure.mk
47 include $(WS_MAKE_RULES)/ips.mk
48
d4b669 49 PATH=$(GCC_ROOT)/bin:$(PATH.illumos)
225938 50
AP 51 # OpenSSL does not use autoconf but its own configure system.
52 CONFIGURE_SCRIPT = $(SOURCE_DIR)/Configure
53
54 # This is to force OpenSSL's Configure script to use gmake for 'make links'. 
55 # Otherwise it fails with:
56 #     mksh: Fatal error in reader: Unmatched `(' on line
57 CONFIGURE_ENV += MAKE="$(GMAKE)"
58
59 # Used in the configure options below.
60 PKCS11_LIB32 = /usr/lib/libpkcs11.so.1
61 PKCS11_LIB64 = /usr/lib/64/libpkcs11.so.1
62 ENGINESDIR_32 = /lib/openssl/engines
63 ENGINESDIR_64 = /lib/openssl/engines/64
64
65 # Configure options common to OpenSSL
66 CONFIGURE_OPTIONS =  -DSOLARIS_OPENSSL -DNO_WINDOWS_BRAINDEATH
67 CONFIGURE_OPTIONS += --openssldir=/etc/openssl
68 CONFIGURE_OPTIONS += --prefix=/usr
87aea7 69 # We use OpenSSL install code for installing only manual pages and headers.
225938 70 CONFIGURE_OPTIONS += --install_prefix=$(PROTO_DIR)
AP 71 CONFIGURE_OPTIONS += no-rc3
72 CONFIGURE_OPTIONS += no-rc5
73 CONFIGURE_OPTIONS += no-mdc2
74 CONFIGURE_OPTIONS += no-idea
75 CONFIGURE_OPTIONS += no-hw_4758_cca
76 CONFIGURE_OPTIONS += no-hw_aep
77 CONFIGURE_OPTIONS += no-hw_atalla
78 CONFIGURE_OPTIONS += no-hw_chil
79 CONFIGURE_OPTIONS += no-hw_gmp
80 CONFIGURE_OPTIONS += no-hw_ncipher
81 CONFIGURE_OPTIONS += no-hw_nuron
82 CONFIGURE_OPTIONS += no-hw_padlock
83 CONFIGURE_OPTIONS += no-hw_sureware
84 CONFIGURE_OPTIONS += no-hw_ubsec
85 CONFIGURE_OPTIONS += no-hw_cswift
86
87 # MD2 is not enabled by default in OpensSSL but some software we have in
88 # Userland needs it. One example is nmap.
89 CONFIGURE_OPTIONS += enable-md2
90 CONFIGURE_OPTIONS += no-seed
91
2eb8fe 92 # Now we have to enable it explicitly
AP 93 CONFIGURE_OPTIONS += enable-ssl2
94
225938 95 # We use both no-whirlpool and no-whrlpool since there is an inconsistency in
AP 96 # the OpenSSL code and one needs both to build OpenSSL successfully with
97 # Whirlpool implementation removed.
98 CONFIGURE_OPTIONS += no-whirlpool
99 CONFIGURE_OPTIONS += no-whrlpool
100
101 # Some additional options needed for our engines.
102 CONFIGURE_OPTIONS += --pk11-libname=$(PKCS11_LIB$(BITS))
103 CONFIGURE_OPTIONS += --enginesdir=$(ENGINESDIR_$(BITS))
104
105 # We define our own compiler and linker option sets for Solaris. See Configure
106 # for more information.
107 CONFIGURE_OPTIONS32_i386 =    solaris-x86-gcc-sunw
d4b669 108 CONFIGURE_OPTIONS32_sparc =    solaris-sparcv9-gcc-sunw
225938 109 CONFIGURE_OPTIONS64_i386 =    solaris64-x86_64-gcc-sunw
d4b669 110 CONFIGURE_OPTIONS64_sparc =    solaris64-sparcv9-gcc-sunw
225938 111
AP 112 # Options specific to regular build.
113 # They must not be specified as common, as they cannot be overridden.
114 $(BUILD_DIR)/$(MACH32)/.configured:    CONFIGURE_OPTIONS += threads
115 $(BUILD_DIR)/$(MACH64)/.configured:    CONFIGURE_OPTIONS += threads
116 $(BUILD_DIR)/$(MACH32)/.configured:    CONFIGURE_OPTIONS += shared
117 $(BUILD_DIR)/$(MACH64)/.configured:    CONFIGURE_OPTIONS += shared
118 $(BUILD_DIR)/$(MACH32)/.configured:    CONFIGURE_OPTIONS += shared
119 $(BUILD_DIR)/$(MACH64)/.configured:    CONFIGURE_OPTIONS += shared
120 $(BUILD_DIR)/$(MACH32)/.configured:    CONFIGURE_OPTIONS += \
121     $(CONFIGURE_OPTIONS32_$(MACH))
122 $(BUILD_DIR)/$(MACH64)/.configured:    CONFIGURE_OPTIONS += \
123     $(CONFIGURE_OPTIONS64_$(MACH))
124
125 # OpenSSL has its own configure system which must be run from the fully
126 # populated source code directory. However, the Userland configuration phase is
127 # run from the build directory. So, we must get the full source code into the
128 # build directory.
55c8e2 129
AP 130 # We do not ship our engines as patches since it would be more difficult to
131 # update the files which have been under continuous development. We rather copy
132 # the files to the right directories.
225938 133 COMPONENT_PRE_CONFIGURE_ACTION = \
55c8e2 134     ( $(CLONEY) $(SOURCE_DIR) $(BUILD_DIR)/$(MACH$(BITS)); \
AP 135       echo "Cloning engines..."; \
136       $(LN) -fs $(COMPONENT_DIR)/engines/pkcs11/*.[ch]        $(@D)/engines; )
225938 137
AP 138 # We deliver only one opensslconf.h file which must be suitable for both 32 and
139 # 64 bits. Depending on the configuration option, OpenSSL's Configure script
140 # creates opensslconf.h for either 32 or 64 bits. A patch makes the resulting
141 # header file usable on both architectures. The patch was generated against the
142 # opensslconf.h version from the 32 bit build.
143 COMPONENT_POST_CONFIGURE_ACTION = \
144     ( [ $(BITS) -eq 32 ] && $(GPATCH) -p1 $(@D)/crypto/opensslconf.h \
145       patches-post-config/opensslconf.patch; cd $(@D); $(MAKE) depend; )
146
5adb75 147 COMPONENT_BUILD_TARGETS= depend all
AP 148
225938 149 # Build openssl-0.9.8 if not yet built.
AP 150 $(COMPONENT_DIR)/../openssl-0.9.8/build/$(MACH32)/.built \
151 $(COMPONENT_DIR)/../openssl-0.9.8/build/$(MACH64)/.built:
152     $(GMAKE) -C $(COMPONENT_DIR)/../openssl-0.9.8 build
153
154 $(PROTO_DIR)/.openssl-0.9.8:    $(COMPONENT_DIR)/../openssl-0.9.8/build/$(MACH32)/.built \
155                 $(COMPONENT_DIR)/../openssl-0.9.8/build/$(MACH64)/.built
156     $(MKDIR) $(PROTO_DIR)/lib/$(MACH64)
157     $(CP) -a $(COMPONENT_DIR)/../openssl-0.9.8/build/$(MACH32)/libssl.so.0.9.8 $(PROTO_DIR)/lib
158     $(CP) -a $(COMPONENT_DIR)/../openssl-0.9.8/build/$(MACH32)/libcrypto.so.0.9.8 $(PROTO_DIR)/lib
159     $(CP) -a $(COMPONENT_DIR)/../openssl-0.9.8/build/$(MACH64)/libssl.so.0.9.8 $(PROTO_DIR)/lib/$(MACH64)
160     $(CP) -a $(COMPONENT_DIR)/../openssl-0.9.8/build/$(MACH64)/libcrypto.so.0.9.8 $(PROTO_DIR)/lib/$(MACH64)
161     $(TOUCH) $@
162
163 # Enable ASLR for this component
164 ASLR_MODE =    $(ASLR_ENABLE)
165
166 configure:    $(CONFIGURE_32_and_64)
167
168 build:        $(BUILD_32_and_64)
169
170 # OpenSSL uses sections man[1357] by default so we must create the man
171 # directories we use for OpenSSL man pages in Solaris. Note that we patch the
172 # OpenSSL man page install script to use the correct directories.
173 MANDIR_SECTIONS =  $(PROTO_DIR)/usr/share/man/man1openssl
174 MANDIR_SECTIONS += $(PROTO_DIR)/usr/share/man/man3openssl
175 MANDIR_SECTIONS += $(PROTO_DIR)/usr/share/man/man5openssl
176 MANDIR_SECTIONS += $(PROTO_DIR)/usr/share/man/man7openssl
177
178 # We must create man page directories manually since we patched OpenSSL install
179 # code to install into manXopenssl instead of manX. Also, OpenSSL does not
180 # install into <dir>/$(MACH64) for 64-bit install so no such directory is
181 # created and Userland install code would fail when installing lint libraries.
182 COMPONENT_PRE_INSTALL_ACTION = ( $(MKDIR) $(MANDIR_SECTIONS); \
183     $(MKDIR) $(PROTO_DIR)/usr/lib/$(MACH64); )
184
185 # The install_docs target will install man pages into $(PROTO_DIR)/$(MANDIR). We
186 # also add /usr/perl5/bin to PATH so that OpenSSL install code can locate the
187 # system pod2man. If not set, OpenSSL make would use an internal implementation
188 # from the tarball which would corrupt some man pages.
189 COMPONENT_INSTALL_ARGS += PATH=$(PATH) MANDIR=/usr/share/man
190
87aea7 191 # Note that we take built binary files from
225938 192 # build directories, not from the proto area which contains whatever was
AP 193 # installed first.
194 install:    $(INSTALL_32_and_64) $(PROTO_DIR)/.openssl-0.9.8
195
196 # There are also separate STC test suites 'openssl' and 'openssl-engine'
197 # for regression testing. These internal tests are unit tests only.
198 COMPONENT_TEST_TARGETS = test
199 test:        $(TEST_32_and_64)
95f6cd 200
4c6706 201 REQUIRED_PACKAGES += developer/build/makedepend
95f6cd 202 REQUIRED_PACKAGES += system/library