1#************************************************************** 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance 9# with the License. You may obtain a copy of the License at 10# 11# http://www.apache.org/licenses/LICENSE-2.0 12# 13# Unless required by applicable law or agreed to in writing, 14# software distributed under the License is distributed on an 15# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16# KIND, either express or implied. See the License for the 17# specific language governing permissions and limitations 18# under the License. 19# 20#************************************************************** 21 22 23 24PRJ=.. 25 26PRJNAME=xmlsecurity 27TARGET=xmlsecurity 28 29# Disable '-z defs' due to broken libxpcom. 30#LINKFLAGSDEFS=$(0) 31USE_DEFFILE=TRUE 32 33# --- Settings ----------------------------------------------------- 34 35.INCLUDE : settings.mk 36.INCLUDE : $(PRJ)$/util$/target.pmk 37 38.IF "$(ENABLE_NSS_MODULE)" != "YES" 39@all: 40 @echo "No nss -> no libxmlsec -> no xmlsecurity..." 41.ENDIF 42 43# --- Files -------------------------------------------------------- 44 45BMP_IN=$(PRJ)$/res 46 47# --- Shared-Library ----------------------------------------------- 48 49# 50# The 1st shared library 51# 52SHL1NAME=xsec_fw 53SHL1TARGET= $(SHL1NAME) 54SHL1LIBS= $(SLB)$/fw.lib 55 56SHL1STDLIBS += \ 57 $(SALLIB) \ 58 $(CPPULIB) \ 59 $(CPPUHELPERLIB) 60 61SHL1IMPLIB = $(SHL1TARGET) 62SHL1DEF = $(MISC)$/$(SHL1TARGET).def 63DEF1NAME = $(SHL1TARGET) 64DEF1EXPORTFILE = xsec_fw.dxp 65 66# 67# The 2nd shared library 68# 69 70SHL2NAME=xsec_xmlsec 71.IF "$(GUI)"=="OS2" 72SHL2NAME=xsec_xs 73.ENDIF 74SHL2TARGET= $(SHL2NAME) 75 76 77SHL2LIBS= \ 78 $(SLB)$/xs_comm.lib 79 80.IF "$(CRYPTO_ENGINE)" == "mscrypto" 81SHL2LIBS += \ 82 $(SLB)$/xs_mscrypt.lib 83.ENDIF 84 85SHL2LIBS += \ 86 $(SLB)$/xs_nss.lib 87 88 89SHL2STDLIBS += \ 90 $(SALLIB) \ 91 $(CPPULIB) \ 92 $(CPPUHELPERLIB) \ 93 $(SALLIB) \ 94 $(SVLLIB) \ 95 $(TOOLSLIB) \ 96 $(COMPHELPERLIB) \ 97 $(CPPUHELPERLIB) \ 98 $(XMLOFFLIB) 99 100.IF "$(OS)"=="SOLARIS" 101SHL2STDLIBS +=-ldl 102.ENDIF 103 104.IF "$(ENABLE_NSS_MODULE)"=="YES" 105.IF "$(SYSTEM_NSS)"!="YES" 106.IF "$(NSPR_LIB)" != "" 107SHL2STDLIBS += $(NSPR_LIB) 108.ENDIF 109.IF "$(NSS_LIB)" != "" 110SHL2STDLIBS += $(NSS_LIB) 111.ENDIF 112.ELSE 113SHL2STDLIBS += $(NSS_LIBS) 114.ENDIF 115.ENDIF 116 117.IF "$(CRYPTO_ENGINE)" == "mscrypto" 118SHL2STDLIBS+= $(MSCRYPTOLIBS) 119# SHL2STDLIBS+= $(XMLSECLIB) $(LIBXML2LIB) $(NSS3LIB) $(NSPR4LIB) $(PLC4LIB) 120SHL2STDLIBS+= $(NSS3LIB) $(NSPR4LIB) 121.ELIF "$(OS)$(SYSTEM_LIBXML)"=="MACOSXYES" 122# The macOS shared-library link template (tg_shl.mk) always searches 123# $(SOLARLIB) -- which includes /usr/lib -- before any of this makefile's 124# own libs, and the SDK bundles its own older libxml2 under /usr/lib. A 125# plain "-lxml2" (as pulled in by NSSCRYPTOLIBS via LIBXML2LIB) resolves 126# to that bundled copy instead of the configured --with-system-libxml one, 127# and it is missing symbols (xmlCtxtPushInput, xmlXPathValuePush) that 128# xmlsec1 needs. Link the intended libxml2 by absolute path so the search 129# order can't shadow it. 130# 131# The path is built from $(LIBXML_PREFIX), not a live `xml2-config` 132# lookup: $(LIBXML_PREFIX) is resolved exactly once by `./configure` 133# (honoring the directory given to --with-system-libxml=DIR, see 134# configure.ac's libxml check) and exported via the generated 135# *Env.Set.sh script -- the same mechanism that already delivers 136# $(LIBXML_CFLAGS)/$(LIBXML_LIBS) (aka $(LIBXML2LIB), solenv/inc/libs.mk) 137# to every other module. Re-running `xml2-config` here at build time 138# instead would re-do that PATH-dependent lookup a second time, 139# independently of configure -- if the build-resume shell's PATH ever 140# differs from the configure shell's (e.g. MacPorts' /opt/local ends up 141# ahead of the intended prefix), that would silently link a stray 142# libxml2.a instead of the intended one, pulling in a different, unrelated 143# set of missing transitive symbols (seen in practice: ICU + GNU libiconv 144# from a MacPorts copy on one machine, liblzma from a different stray copy 145# on another). Going through $(LIBXML_PREFIX) removes that ambiguity. 146# 147# Prefer the dylib when one is actually present at that prefix: unlike a 148# static archive, a dylib records its own transitive links (e.g. to libz), 149# so the linker resolves those automatically and no extra -lz/-llzma is 150# needed. Fall back to the static archive (community builds normally only 151# install that, via --enable-shared=no) when no dylib exists there. 152# 153# The existence check is resolved into a plain macro first, then branched 154# on -- dmake's .IF does not reliably evaluate a $(shell ...) call written 155# directly inside the condition string itself. 156# 157# The leading "-" is load-bearing: dmake runs $(shell ...) as a phony 158# recipe named "Shell escape" and, same as any other recipe line, treats 159# a non-zero exit as a fatal build error unless the line is marked 160# ignore-errors (the same leading "-" convention as normal recipes, 161# handled by Rcp_attribute() in dag.c). "test -f X && echo yes" exits 1 162# whenever X does not exist -- the expected, common case here, since 163# community builds normally only install libxml2 as a static archive 164# (--enable-shared=no, no dylib at all) -- so without the "-" this aborts 165# the whole build the moment no dylib is found, instead of just leaving 166# the macro empty. 167# 168# --with-static-system-libs=libxml pins this to the archive, so a dylib 169# appearing at the prefix can't silently turn a release build dynamic. 170.IF "$(STATIC_SYSTEM_LIBXML)"=="YES" 171XMLSECURITY_LIBXML2_HAS_DYLIB:= 172.ELSE 173XMLSECURITY_LIBXML2_HAS_DYLIB:=$(shell -test -f $(LIBXML_PREFIX)/lib/libxml2.dylib && echo yes) 174.ENDIF 175.IF "$(XMLSECURITY_LIBXML2_HAS_DYLIB)"=="yes" 176XMLSECURITY_SYSTEM_LIBXML2:=$(LIBXML_PREFIX)/lib/libxml2.dylib 177XMLSECURITY_SYSTEM_LIBXML2_EXTRALIBS:= 178.ELSE 179XMLSECURITY_SYSTEM_LIBXML2:=$(LIBXML_PREFIX)/lib/libxml2.a 180# The static archive carries no dependency info, so zlib must be linked 181# explicitly here to satisfy libxml2's HTTP/gzip symbols (deflate, 182# inflate, gzopen, ...). liblzma is linked only if actually present next 183# to it: it's not part of the documented static-lib bundle, so only 184# needed if this libxml2 build happens to have xz support compiled in. 185# (See above for why the leading "-" is required.) 186XMLSECURITY_SYSTEM_LIBLZMA:=$(shell -test -f $(LIBXML_PREFIX)/lib/liblzma.a -o -f $(LIBXML_PREFIX)/lib/liblzma.dylib && echo $(LIBXML_PREFIX)/lib/liblzma.a) 187XMLSECURITY_SYSTEM_LIBXML2_EXTRALIBS:=$(ZLIB3RDLIB) $(XMLSECURITY_SYSTEM_LIBLZMA) 188.ENDIF 189SHL2STDLIBS+= $(XMLSECLIB-NSS) $(XMLSECLIB) $(XMLSECURITY_SYSTEM_LIBXML2) $(XMLSECURITY_SYSTEM_LIBXML2_EXTRALIBS) $(NSS3LIB) $(NSPR4LIB) $(PLC4LIB) 190.ELSE 191SHL2STDLIBS+= $(NSSCRYPTOLIBS) 192.ENDIF 193 194 195SHL2IMPLIB = $(SHL2TARGET) 196SHL2DEF = $(MISC)$/$(SHL2TARGET).def 197DEF2NAME = $(SHL2TARGET) 198.IF "$(CRYPTO_ENGINE)" == "mscrypto" 199DEF2EXPORTFILE = exports_xsmscrypt.dxp 200.ENDIF 201 202DEF2EXPORTFILE = exports_xsnss.dxp 203 204SRSFILELIST= \ 205 $(SRS)$/component.srs \ 206 $(SRS)$/dialogs.srs 207 208RESLIB1NAME=xmlsec 209RESLIB1IMAGES=$(PRJ)$/res 210RESLIB1SRSFILES= $(SRSFILELIST) 211 212SHL4TARGET=$(TARGET) 213.IF "$(GUI)"=="OS2" 214SHL4TARGET=xmlsecur 215.ENDIF 216SHL4LIBS=\ 217 $(SLB)$/helper.lib \ 218 $(SLB)$/dialogs.lib \ 219 $(SLB)$/component.lib 220 221SHL4STDLIBS=\ 222 $(CPPULIB) \ 223 $(CPPUHELPERLIB) \ 224 $(COMPHELPERLIB) \ 225 $(UCBHELPERLIB) \ 226 $(UNOTOOLSLIB) \ 227 $(VCLLIB) \ 228 $(TOOLSLIB) \ 229 $(SVTOOLLIB) \ 230 $(SALLIB) \ 231 $(SVLLIB) \ 232 $(XMLOFFLIB) \ 233 $(SVXCORELIB) 234 235SHL4VERSIONMAP = $(SOLARENV)/src/component.map 236SHL4DEPN= 237SHL4IMPLIB=i$(TARGET) 238SHL4DEF=$(MISC)$/$(SHL4TARGET).def 239DEF4NAME=$(SHL4TARGET) 240 241# --- Targets ---------------------------------------------------------- 242 243.INCLUDE : target.mk 244 245# --- Filter ----------------------------------------------------------- 246 247$(MISC)$/$(SHL3TARGET).flt: makefile.mk 248 $(TYPE) $(SHL3TARGET).flt > $@ 249 250ALLTAR : \ 251 $(MISC)/xmlsecurity.component \ 252 $(MISC)/xsec_fw.component \ 253 $(MISC)/xsec_xmlsec.component 254 255.IF "$(OS)" == "WNT" 256my_platform = .windows 257.END 258 259$(MISC)/xmlsecurity.component .ERRREMOVE : \ 260 $(SOLARENV)/bin/createcomponent.xslt xmlsecurity.component 261 $(XSLTPROC) --nonet --stringparam uri \ 262 '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL4TARGETN:f)' -o $@ \ 263 $(SOLARENV)/bin/createcomponent.xslt xmlsecurity.component 264 265$(MISC)/xsec_fw.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ 266 xsec_fw.component 267 $(XSLTPROC) --nonet --stringparam uri \ 268 '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ 269 $(SOLARENV)/bin/createcomponent.xslt xsec_fw.component 270 271$(MISC)/xsec_xmlsec.component .ERRREMOVE : \ 272 $(SOLARENV)/bin/createcomponent.xslt xsec_xmlsec.component 273 $(XSLTPROC) --nonet --stringparam uri \ 274 '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL2TARGETN:f)' -o $@ \ 275 $(SOLARENV)/bin/createcomponent.xslt xsec_xmlsec$(my_platform).component 276