1 #
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 #
21 # Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
22 # Copyright (c) 2012-2013, Joyent, Inc. All rights reserved.
23 #
24
25 VER = openssl-1.0.1d
26 LIBVER = 1.0.0
27
28 include ../Makefile.defs
29
30 SHELL = /bin/bash
31 BUILD64 = yes
32 UNPACK_SENTINEL = Configure
33 AUTOCONF_OUT = crypto/opensslconf.h
34
35 MT_CPPFLAGS = -D_REENTRANT
36 SHARED_CFLAGS = -fPIC -DPIC
37 SHARED_LDFLAGS = -fPIC -shared
38
39 PKCS11_SRCS = \
40 hw_pk11_err.c \
41 hw_pk11_err.h \
42 hw_pk11_pub.c \
43 hw_pk11_uri.c \
44 hw_pk11_uri.h \
45 hw_pk11.c \
46 hw_pk11.h
47
48 PKCS11_DST.32 = $(VER.32)/crypto/engine
49 PKCS11_DST.64 = $(VER.64)/crypto/engine
50
51 PKCS11.32 = $(PKCS11_SRCS:%=$(PKCS11_DST.32)/%)
52 PKCS11.64 = $(PKCS11_SRCS:%=$(PKCS11_DST.64)/%)
53
54 CHECK_LIBS = \
55 $(VER.32)/libsunw_crypto.so.$(LIBVER) \
56 $(VER.32)/libsunw_ssl.so.$(LIBVER) \
57 $(VER.64)/libsunw_crypto.so.$(LIBVER) \
58 $(VER.64)/libsunw_ssl.so.$(LIBVER)
59
60 #
61 # There are races between the building of assembly language sources and
62 # the assembly of those files. Disable parallel build.
63 #
64 PARALLEL =
65
66 CPPFLAGS += \
67 -DSOLARIS_OPENSSL \
68 -DNO_WINDOWS_BRAINDEATH \
69 -include openssl/sunw_prefix.h
70
71 CFLAGS += \
72 -O3 \
73 -march=pentium \
74 -Wall \
75 -Werror \
76 -DPK11_LIB_LOCATION=\\"/usr/lib/libpkcs11.so.1\\"
77
78 CFLAGS.64 += \
79 -O3 \
80 -Wall \
81 -Werror \
82 -DPK11_LIB_LOCATION=\\"/usr/lib/64/libpkcs11.so.1\\"
83
84 LIBS += -lsocket -lnsl
85
86 ifeq ($(STRAP),strap)
87 LDFLAGS += $(SYSLIBDIRS:%=-R$(DESTDIR)/%)
88 LDFLAGS.64 += $(SYSLIBDIRS:%=-R$(DESTDIR)/%/64)
89 endif
90
91 PATCHES = Patches/*
92
93 AUTOCONF_ENV =
94 AUTOCONF_OPTS += \
95 --openssldir=/etc/openssl \
96 --install_prefix=$(DESTDIR) \
97 no-ec \
98 no-ecdh \
99 no-ecdsa \
100 no-rc3 \
101 no-rc5 \
102 no-mdc2 \
103 no-idea \
104 no-hw_4758_cca \
105 no-hw_aep \
106 no-hw_atalla \
107 no-hw_chil \
108 no-hw_gmp \
109 no-hw_ncipher \
110 no-hw_nuron \
111 no-hw_padlock \
112 no-hw_sureware \
113 no-hw_ubsec \
114 no-hw_cswift \
115 enable-md2 \
116 threads \
117 shared
118
119 AUTOCONF_OPTS.32 += \
120 smartos-x86-gcc
121
122 AUTOCONF_OPTS.64 += \
123 smartos64-x86_64-gcc
124
125 $(PKCS11_DST.32)/%: engine_pkcs11/%
126 cp $< $@
127
128 $(PKCS11_DST.64)/%: engine_pkcs11/%
129 cp $< $@
130
131 $(VER.32)/%: %
132 cp $< $@
133
134 $(VER.64)/%: %
135 cp $< $@
136
137 $(VER.32)/configure: $(VER.32)/Configure Makefile $(PKCS11.32) \
138 $(VER.32)/sunw_prefix.h
139 sed -e 's#@@CC@@#$(GCC)#g' \
140 -e 's#@@CPPFLAGS@@#$(CPPFLAGS)#g' \
141 -e 's#@@CFLAGS@@#$(CFLAGS)#g' \
142 -e 's#@@MT_CPPFLAGS@@#$(MT_CPPFLAGS)#g' \
143 -e 's#@@LDFLAGS@@#$(LDFLAGS)#g' \
144 -e 's#@@LIBS@@#$(LIBS)#g' \
145 -e 's#@@SHARED_CFLAGS@@#$(SHARED_CFLAGS)#g' \
146 -e 's#@@SHARED_LDFLAGS@@#$(SHARED_LDFLAGS)#g' < $< > $@
147 chmod +x $@
148
149 $(VER.64)/configure: $(VER.64)/Configure Makefile $(PKCS11.64) \
150 $(VER.64)/sunw_prefix.h
151 sed -e 's#@@CC@@#$(GCC.64)#g' \
152 -e 's#@@CPPFLAGS@@#$(CPPFLAGS)#g' \
153 -e 's#@@CFLAGS@@#$(CFLAGS.64)#g' \
154 -e 's#@@MT_CPPFLAGS@@#$(MT_CPPFLAGS)#g' \
155 -e 's#@@LDFLAGS@@#$(LDFLAGS.64)#g' \
156 -e 's#@@LIBS@@#$(LIBS)#g' \
157 -e 's#@@SHARED_CFLAGS@@#$(SHARED_CFLAGS)#g' \
158 -e 's#@@SHARED_LDFLAGS@@#$(SHARED_LDFLAGS)#g' < $< > $@
159 chmod +x $@
160
161 all: all_autoconf
162
163 check: $(CHECK_LIBS:%=%.check)
164
165 %.check: %
166 syms="$$(/usr/bin/nm -ph $< | \
167 awk '$$2 == T && $$3 != _init && $$3 != _fini { print $$3 }' | \
168 grep -v ^sunw_)"; \
169 if [[ -n "$$syms" ]]; then \
170 echo "Unprefixed symbols found in $<: $$syms"; \
171 exit 1; \
172 else \
173 touch $@; \
174 fi
175
176 $(CHECK_LIBS): all
177
178 install_32: all check
179 DESTDIR=$(DESTDIR) VERDIR=$(VER.32) LIBVER=$(LIBVER) \
180 ksh93 ./install-sfw
181
182 install_64: all check
183 DESTDIR=$(DESTDIR) VERDIR=$(VER.64) LIBVER=$(LIBVER) \
184 ksh93 ./install-sfw-64
185
186 install: install_32 install_64
187
188 include ../Makefile.targ