xref: /trunk/main/libxmlsec/makefile.mk (revision 45c5a00162811bd03b87fcb4fe9996782f2b59ec)
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=xmlsec1
27TARGET=so_xmlsec1
28EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
29
30# --- Settings -----------------------------------------------------
31
32.INCLUDE :  settings.mk
33
34.IF "$(ENABLE_NSS_MODULE)" == "NO"
35@all:
36    @echo "No nss -> no libxmlsec...."
37.ENDIF
38
39# --- Files --------------------------------------------------------
40
41XMLSEC1VERSION=1.2.14
42
43TARFILE_NAME=$(PRJNAME)-$(XMLSEC1VERSION)
44TARFILE_MD5=1f24ab1d39f4a51faf22244c94a6203f
45
46#xmlsec1-configure.patch: Set up the build. Straightforward configuration
47#xmlsec1-configure-libxml-libxslt.patch: empty "$with_libxml" prepends /bin :-(
48#xmlsec1-olderlibxml2.patch: Allow build against older libxml2, for macosx
49#xmlsec1-nssdisablecallbacks.patch: Disable use of smime3 so don't need to package it
50#xmlsec1-customkeymanage.patch: Could we do this alternatively outside xmlsec
51#xmlsec1-nssmangleciphers.patch: Dubious, do we still need this ?
52#xmlsec1-noverify.patch: As per readme.txt.
53#xmlsec1-mingw32.patch: Mingw32 support.
54#xmlsec1-mingw-customkeymanage-addmscrypto.patch builds the custom keymanager on mingw
55PATCH_FILES=\
56   xmlsec1-configure.patch \
57   xmlsec1-configure-libxml-libxslt.patch \
58   xmlsec1-olderlibxml2.patch \
59   xmlsec1-nssdisablecallbacks.patch \
60   xmlsec1-customkeymanage.patch \
61   xmlsec1-nssmangleciphers.patch \
62   xmlsec1-noverify.patch \
63   xmlsec1-mingw32.patch \
64   xmlsec1-mingw-keymgr-mscrypto.patch \
65   xmlsec1-nowin98.patch \
66   xmlsec1-ucrt-snprintf.patch
67
68.IF "$(GUI)"=="OS2"
69PATCH_FILES+=xmlsec1-os2.patch
70.ENDIF
71
72ADDITIONAL_FILES= \
73    include$/xmlsec$/mscrypto$/akmngr.h \
74    src$/mscrypto$/akmngr.c \
75    include$/xmlsec$/nss$/akmngr.h \
76    include$/xmlsec$/nss$/ciphers.h \
77    include$/xmlsec$/nss$/tokens.h \
78    src$/nss$/akmngr.c \
79    src$/nss$/keywrapers.c \
80    src$/nss$/tokens.c
81
82.IF "$(GUI)"=="WNT"
83CRYPTOLIB=mscrypto
84#CRYPTOLIB=nss
85#BASEINC=$(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)$/mozilla;$(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)$/mozilla$/nspr;$(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)$/mozilla$/nss;$(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)$/external
86#BASELIB=$(SOLARVERSION)$/$(INPATH)$/lib$(UPDMINOREXT)
87.ELSE
88CRYPTOLIB=nss
89.ENDIF
90
91.IF "$(OS)"=="WNT"
92.IF "$(COM)"=="GCC"
93xmlsec_CC=$(CC) -mthreads
94.IF "$(MINGW_SHARED_GCCLIB)"=="YES"
95xmlsec_CC+=-shared-libgcc
96.ENDIF
97xmlsec_LIBS=
98.IF "$(MINGW_SHARED_GXXLIB)"=="YES"
99xmlsec_LIBS+=$(MINGW_SHARED_LIBSTDCPP)
100.ENDIF
101CONFIGURE_DIR=
102CONFIGURE_ACTION=.$/configure
103CONFIGURE_FLAGS=--with-libxslt=no --with-openssl=no --with-gnutls=no --enable-mscrypto --disable-crypto-dl --build=i586-pc-mingw32 --host=i586-pc-mingw32 CC="$(xmlsec_CC)" LDFLAGS="-no-undefined -L$(ILIB:s/;/ -L/)" LIBS="$(xmlsec_LIBS)" LIBXML2LIB=$(LIBXML2LIB) ZLIB3RDLIB=$(ZLIB3RDLIB) OBJDUMP="$(WRAPCMD) objdump"
104
105.IF "$(SYSTEM_NSS)" != "YES"
106CONFIGURE_FLAGS+=--enable-pkgconfig=no
107.ENDIF
108BUILD_ACTION=$(GNUMAKE) -j$(EXTMAXPROCESS)
109BUILD_DIR=$(CONFIGURE_DIR)
110.ELSE
111CONFIGURE_DIR=win32
112CONFIGURE_ACTION=cscript configure.js
113.IF "$(product)"!="full" && "$(CCNUMVER)" >= "001399999999"
114CONFIGURE_FLAGS=crypto=$(CRYPTOLIB) debug=yes xslt=no iconv=no static=no include=$(BASEINC) lib=$(BASELIB)
115.ELSE
116CONFIGURE_FLAGS=crypto=$(CRYPTOLIB) xslt=no iconv=no static=no include=$(BASEINC) lib=$(BASELIB)
117.ENDIF
118# /OPT:NOWIN98 was removed from link.exe after VS2008 and is now LNK1117.
119# Switched off only for the UCRT toolset, so a VC9 build keeps the exact
120# link command line it has always had.
121.IF "$(COMEX)" == "14"
122BUILD_ACTION=nmake WIN98COMPAT=0
123.ELSE
124BUILD_ACTION=nmake
125.ENDIF
126BUILD_DIR=$(CONFIGURE_DIR)
127.ENDIF
128.ELSE
129.IF "$(GUI)"=="UNX"
130
131.IF "$(COM)"=="C52" && "$(CPU)"=="U"
132xmlsec_CFLAGS+=-m64
133.ENDIF
134
135.IF "$(SYSBASE)"!=""
136xmlsec_CFLAGS+=-I$(SYSBASE)$/usr$/include
137.IF "$(COMNAME)"=="sunpro5"
138xmlsec_CFLAGS+=$(C_RESTRICTIONFLAGS)
139.ENDIF          # "$(COMNAME)"=="sunpro5"
140.IF "$(EXTRA_CFLAGS)"!=""
141xmlsec_CFLAGS+=$(EXTRA_CFLAGS)
142xmlsec_CPPFLAGS+=$(EXTRA_CFLAGS)
143.ENDIF # "$(EXTRA_CFLAGS)"!=""
144xmlsec_LDFLAGS+=-L$(SYSBASE)$/usr$/lib
145.ELIF "$(OS)"=="MACOSX" # "$(SYSBASE)"!=""
146xmlsec_CPPFLAGS+=$(EXTRA_CDEFS)
147.ENDIF
148
149.IF "$(OS)$(COM)"=="LINUXGCC" || "$(OS)$(COM)"=="FREEBSDGCC"
150xmlsec_LDFLAGS+=-Wl,-rpath,'$$$$ORIGIN:$$$$ORIGIN/../ure-link/lib'
151.ENDIF          # "$(OS)$(COM)"=="LINUXGCC"
152.IF "$(OS)$(COM)"=="SOLARISC52"
153xmlsec_LDFLAGS+=-Wl,-R'$$$$ORIGIN:$$$$ORIGIN/../ure-link/lib'
154.ENDIF          # "$(OS)$(COM)"=="SOLARISC52"
155
156LDFLAGS:=$(xmlsec_LDFLAGS)
157.EXPORT: LDFLAGS
158
159.ENDIF
160CONFIGURE_DIR=
161CONFIGURE_ACTION=.$/configure ADDCFLAGS="$(xmlsec_CFLAGS)" CPPFLAGS="$(xmlsec_CPPFLAGS)"
162CONFIGURE_FLAGS=--with-pic --disable-shared --disable-crypto-dl --with-libxslt=no --with-openssl=no --with-gnutls=no LIBXML2LIB="$(LIBXML2LIB)"
163# Pin xmlsec's libxml2 lookup to the prefix configure settled on.
164#
165# Without --with-libxml the AOO patches leave xmlsec resolving a bare
166# "xml2-config" off $PATH, which on a Mac carrying MacPorts/Homebrew is
167# often not the one --with-system-libxml named. The mis-pick is silent
168# until link time: newer libxml2 renamed the stack helpers but kept the
169# old spellings as macros (inputPush -> xmlCtxtPushInput, valuePush ->
170# xmlXPathValuePush), so xmlsec 1.2.14 built against post-rename headers
171# emits the new names and the older archive xmlsecurity links lacks them.
172# Compile-side counterpart to the absolute-path link fix in
173# xmlsecurity/util/makefile.mk and forms/util/makefile.mk; both are needed.
174#
175# Guarded on SYSTEM_LIBXML: the internal build already gets an
176# absolute-path xml2-config, which AC_PATH_PROG honors as-is.
177.IF "$(SYSTEM_LIBXML)"=="YES" && "$(LIBXML_PREFIX)"!=""
178CONFIGURE_FLAGS+=--with-libxml=$(LIBXML_PREFIX)
179.ENDIF
180# system-nss needs pkgconfig to get the information about nss
181# FIXME: This also will enable pkg-config usage for libxml2. It *seems*
182# that the internal headers still are used when they are there but....
183# (and that pkg-config is allowed to fail...)
184# I have no real good idea how to get mozilla (nss) pkg-config'ed and libxml2
185# not... We need mozilla-nss pkg-config'ed since we can *not* just use
186# --with-nss or parse -pkg-config --libs / cflags mozilla-nss since
187# the lib may a) be in /usr/lib (Debian) and be not in $with_nss/include
188# $with_nss/lib.
189.IF "$(SYSTEM_NSS)" != "YES"
190CONFIGURE_FLAGS+=--enable-pkgconfig=no
191.ENDIF
192BUILD_ACTION=$(GNUMAKE) -j$(EXTMAXPROCESS)
193BUILD_DIR=$(CONFIGURE_DIR)
194.ENDIF
195
196
197OUTDIR2INC=include$/xmlsec
198
199.IF "$(OS)"=="WNT"
200.IF "$(COM)"=="GCC"
201OUT2LIB+=src$/.libs$/libxmlsec1.dll.a src$/nss$/.libs$/libxmlsec1-nss.dll.a src$/mscrypto$/.libs$/libxmlsec1-mscrypto.dll.a
202OUT2BIN+=src$/.libs$/libxmlsec1.dll src$/nss$/.libs$/libxmlsec1-nss.dll src$/mscrypto$/.libs$/libxmlsec1-mscrypto.dll
203.ELSE
204OUT2LIB+=win32$/binaries$/*.lib
205OUT2BIN+=win32$/binaries$/*.dll
206.ENDIF
207.ELIF "$(OS)"=="OS2"
208OUT2LIB+=src$/.libs$/xmlsec1.lib src$/nss$/.libs$/xmlsec1-nss.lib
209OUT2BIN+=src$/xmlsec1.dll src$/nss$/xmlsec1n.dll
210.ELSE
211OUT2LIB+=src$/.libs$/libxmlsec1.a src$/nss$/.libs$/libxmlsec1-nss.a
212.ENDIF
213
214# --- Targets ------------------------------------------------------
215
216.INCLUDE : set_ext.mk
217.INCLUDE : target.mk
218.INCLUDE : tg_ext.mk
219