Skip to content

Commit afd9294

Browse files
authored
Update libxml2 and libxslt on Windows and switch to new cmake build system (#915)
1 parent a1bc4b5 commit afd9294

File tree

1 file changed

+84
-18
lines changed

1 file changed

+84
-18
lines changed

scripts/build_windows.sh

Lines changed: 84 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
#
55
# $ c:\cygwin64\bin\bash build_windows.sh
66
#
7-
libxml2_version="2.13.5"
8-
libxslt_version="1.1.42"
9-
openssl_version="3.4.1"
7+
libxml2_version="2.14.3"
8+
libxslt_version="1.1.43"
9+
openssl_version="3.5.0"
1010
xmlsec_version="1.3.8-rc1"
1111

1212
pwd=`pwd`
@@ -24,6 +24,13 @@ zip_output_file="${distro_dir}\\xmlsec1-${xmlsec_version}-win64.zip"
2424
PERL_PATH="C:\\Strawberry\\perl\\bin"
2525
LOG_FILE=`cygpath "C:\\temp\\build-windows.log"`
2626

27+
CMAKE_XMLSEC_BUILDDIR=builddir
28+
CMAKE_XMLSEC_ARCH="x64"
29+
CMAKE_XMLSEC_GENERATOR="Visual Studio 17 2022"
30+
CMAKE_XMLSEC_RUNTIME="MultiThreadedDLL"
31+
CMAKE_XMLSEC_CONFIG=Release
32+
CMAKE_XMLSEC_SHARED_LIBS=OFFF
33+
2734
function build_libxml2 {
2835
# check if already built
2936
full_name="libxml2-v${libxml2_version}"
@@ -52,14 +59,23 @@ function build_libxml2 {
5259
tar xvfz "${full_name}.tar.gz" 2>> "${LOG_FILE}"
5360

5461
echo "*** Configuring \"${full_name}\" ..."
55-
cd "${full_name}\win32"
56-
cscript configure.js iconv=no zlib=no cruntime=/MD prefix="${libxml2_output_dir}" >> "${LOG_FILE}"
62+
cd "${full_name}"
63+
cmake -B "${CMAKE_XMLSEC_BUILDDIR}" -A "${CMAKE_XMLSEC_ARCH}" -G "${CMAKE_XMLSEC_GENERATOR}" -D CMAKE_MSVC_RUNTIME_LIBRARY="${CMAKE_XMLSEC_RUNTIME}" -D BUILD_SHARED_LIBS="${CMAKE_XMLSEC_SHARED_LIBS}" -D CMAKE_PREFIX_PATH="${distro_dir}" -D CMAKE_INSTALL_PREFIX="${libxml2_output_dir}" -D LIBXML2_WITH_ICONV=OFF -D LIBXML2_WITH_PYTHON=OFF -D LIBXML2_WITH_ZLIB=OFF >> "${LOG_FILE}"
64+
if [ $? -ne 0 ]; then
65+
exit $?
66+
fi
5767

5868
echo "*** Building \"${full_name}\" ..."
59-
nmake >> "${LOG_FILE}"
69+
cmake --build "${CMAKE_XMLSEC_BUILDDIR}" --config "${CMAKE_XMLSEC_CONFIG}" >> "${LOG_FILE}"
70+
if [ $? -ne 0 ]; then
71+
exit $?
72+
fi
6073

6174
echo "*** Installing \"${full_name}\" ..."
62-
nmake install >> "${LOG_FILE}"
75+
cmake --install "${CMAKE_XMLSEC_BUILDDIR}" --config "${CMAKE_XMLSEC_CONFIG}" >> "${LOG_FILE}"
76+
if [ $? -ne 0 ]; then
77+
exit $?
78+
fi
6379

6480
echo "*** Done with \"${full_name}\"!!!"
6581
return 0
@@ -93,14 +109,23 @@ function build_libxslt {
93109
tar xvfz "${full_name}.tar.gz" 2>> "${LOG_FILE}"
94110

95111
echo "*** Configuring \"${full_name}\" ..."
96-
cd "${full_name}\win32"
97-
cscript configure.js iconv=no zlib=no cruntime=/MD prefix="${libxslt_output_dir}" include="${libxml2_output_dir}\include\libxml2" lib="${libxml2_output_dir}\lib"
112+
cd "${full_name}"
113+
cmake -B "${CMAKE_XMLSEC_BUILDDIR}" -A "${CMAKE_XMLSEC_ARCH}" -G "${CMAKE_XMLSEC_GENERATOR}" -D CMAKE_MSVC_RUNTIME_LIBRARY="${CMAKE_XMLSEC_RUNTIME}" -D BUILD_SHARED_LIBS="${CMAKE_XMLSEC_SHARED_LIBS}" -D CMAKE_PREFIX_PATH="${distro_dir}" -D CMAKE_INSTALL_PREFIX="${libxslt_output_dir}" >> "${LOG_FILE}"
114+
if [ $? -ne 0 ]; then
115+
exit $?
116+
fi
98117

99118
echo "*** Building \"${full_name}\" ..."
100-
nmake >> "${LOG_FILE}"
119+
cmake --build "${CMAKE_XMLSEC_BUILDDIR}" --config "${CMAKE_XMLSEC_CONFIG}" >> "${LOG_FILE}"
120+
if [ $? -ne 0 ]; then
121+
exit $?
122+
fi
101123

102124
echo "*** Installing \"${full_name}\" ..."
103-
nmake install >> "${LOG_FILE}"
125+
cmake --install "${CMAKE_XMLSEC_BUILDDIR}" --config "${CMAKE_XMLSEC_CONFIG}" >> "${LOG_FILE}"
126+
if [ $? -ne 0 ]; then
127+
exit $?
128+
fi
104129

105130
echo "*** Done with \"${full_name}\"!!!"
106131
return 0
@@ -139,12 +164,21 @@ function build_openssl {
139164
cd "${full_name}"
140165
perl Configure no-unit-test --prefix="${openssl_output_dir}" --release VC-WIN64A
141166
PATH="$OLD_PATH"
167+
if [ $? -ne 0 ]; then
168+
exit $?
169+
fi
142170

143171
echo "*** Building \"${full_name}\" ..."
144172
nmake >> "${LOG_FILE}"
173+
if [ $? -ne 0 ]; then
174+
exit $?
175+
fi
145176

146177
echo "*** Installing \"${full_name}\" ..."
147178
nmake install_sw >> "${LOG_FILE}"
179+
if [ $? -ne 0 ]; then
180+
exit $?
181+
fi
148182

149183
echo "*** Done with \"${full_name}\"!!!"
150184
return 0
@@ -182,13 +216,21 @@ function build_xmlsec {
182216
echo "*** Configuring \"${full_name}\" ..."
183217
cd "${full_name_without_rc}\win32"
184218
cscript configure.js pedantic=yes werror=yes with-dl=yes cruntime=/MD xslt=yes crypto=openssl,mscng unicode=yes prefix="${xmlsec_output_dir}" include="${libxml2_output_dir}\include;${libxml2_output_dir}\include\libxml2;${libxslt_output_dir}\include;${openssl_output_dir}\include" lib="${libxml2_output_dir}\lib;${libxslt_output_dir}\lib;${openssl_output_dir}\lib"
185-
219+
if [ $? -ne 0 ]; then
220+
exit $?
221+
fi
186222

187223
echo "*** Building \"${full_name}\" ..."
188224
nmake >> "${LOG_FILE}"
225+
if [ $? -ne 0 ]; then
226+
exit $?
227+
fi
189228

190229
echo "*** Installing \"${full_name}\" ..."
191230
nmake install >> "${LOG_FILE}"
231+
if [ $? -ne 0 ]; then
232+
exit $?
233+
fi
192234

193235
echo "*** Done with \"${full_name}\"!!!"
194236
return 0
@@ -219,12 +261,36 @@ function create_distro {
219261
rm "${LOG_FILE}"
220262
echo "*** LOG FILE: \"${LOG_FILE}\""
221263

222-
build_libxml2
223-
build_libxslt
224-
build_openssl
225-
build_xmlsec
226-
create_readme
227-
create_distro
264+
if [ "z$1" = "zcleanup" ] ; then
265+
echo "*** CLEANUP ..."
266+
rm -rf "${libxml2_output_dir}" "${libxslt_output_dir}" "${openssl_output_dir}" "${xmlsec_output_dir}"
267+
else
268+
echo "*** BUILD ..."
269+
build_libxml2
270+
if [ $? -ne 0 ]; then
271+
exit $?
272+
fi
273+
build_libxslt
274+
if [ $? -ne 0 ]; then
275+
exit $?
276+
fi
277+
build_openssl
278+
if [ $? -ne 0 ]; then
279+
exit $?
280+
fi
281+
build_xmlsec
282+
if [ $? -ne 0 ]; then
283+
exit $?
284+
fi
285+
create_readme
286+
if [ $? -ne 0 ]; then
287+
exit $?
288+
fi
289+
create_distro
290+
if [ $? -ne 0 ]; then
291+
exit $?
292+
fi
293+
fi
228294

229295
exit 0
230296

0 commit comments

Comments
 (0)