Skip to content

Commit ab43756

Browse files
committed
ci: use official libxml2 release
This extends the same logic of other dependencies and avoids bugs in the vcpkg port.
1 parent 0771bdc commit ab43756

File tree

2 files changed

+87
-33
lines changed

2 files changed

+87
-33
lines changed

.github/workflows/ci.yml

+28-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ jobs:
8787
TZ: 'Etc/UTC'
8888
with:
8989
apt-get: ${{ matrix.install }} git build-essential python3 curl openjdk-11-jdk ninja-build pkg-config libncurses-dev
90-
vcpkg: libxml2[tools]
9190
cc: ${{ steps.setup-cpp.outputs.cc || matrix.cc }}
9291
ccflags: ${{ matrix.ccflags }}
9392
cxx: ${{ steps.setup-cpp.outputs.cxx || matrix.cxx }}
@@ -147,6 +146,32 @@ jobs:
147146
fi
148147
echo -E "duktape-root=$duktape_root" >> $GITHUB_OUTPUT
149148
149+
- name: Install Libxml2
150+
id: libxml2-install
151+
shell: bash
152+
run: |
153+
set -x
154+
cd ..
155+
mkdir -p third-party
156+
cd third-party
157+
git config --global init.defaultBranch master
158+
git config --global advice.detachedHead false
159+
git clone https://github.com/GNOME/libxml2 --branch v2.12.6 --depth 1
160+
cd libxml2
161+
162+
cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DLIBXML2_WITH_PROGRAMS=ON -DLIBXML2_WITH_FTP=OFF -DLIBXML2_WITH_HTTP=OFF -DLIBXML2_WITH_ICONV=OFF -DLIBXML2_WITH_LEGACY=OFF -DLIBXML2_WITH_LZMA=OFF -DLIBXML2_WITH_ZLIB=OFF -DLIBXML2_WITH_ICU=OFF -DLIBXML2_WITH_TESTS=OFF -DLIBXML2_WITH_HTML=ON -DLIBXML2_WITH_C14N=ON -DLIBXML2_WITH_CATALOG=ON -DLIBXML2_WITH_DEBUG=ON -DLIBXML2_WITH_ISO8859X=ON -DLIBXML2_WITH_MEM_DEBUG=OFF -DLIBXML2_WITH_MODULES=ON -DLIBXML2_WITH_OUTPUT=ON -DLIBXML2_WITH_PATTERN=ON -DLIBXML2_WITH_PUSH=ON -DLIBXML2_WITH_PYTHON=OFF -DLIBXML2_WITH_READER=ON -DLIBXML2_WITH_REGEXPS=ON -DLIBXML2_WITH_SAX1=ON -DLIBXML2_WITH_SCHEMAS=ON -DLIBXML2_WITH_SCHEMATRON=ON -DLIBXML2_WITH_THREADS=ON -DLIBXML2_WITH_THREAD_ALLOC=OFF -DLIBXML2_WITH_TREE=ON -DLIBXML2_WITH_VALID=ON -DLIBXML2_WITH_WRITER=ON -DLIBXML2_WITH_XINCLUDE=ON -DLIBXML2_WITH_XPATH=ON -DLIBXML2_WITH_XPTR=ON -DCMAKE_CXX_COMPILER=${{ steps.setup-cpp.outputs.cxx || steps.parameters.outputs.clang-bin }} -DCMAKE_C_COMPILER=${{ steps.setup-cpp.outputs.cc || steps.parameters.outputs.clang-bin }}
163+
N_CORES=$(nproc 2>/dev/null || echo 1)
164+
cmake --build ./build --config ${{ matrix.build-type }} --parallel $N_CORES
165+
cmake --install ./build --prefix ./install
166+
167+
libxml2_root=$(pwd)/install
168+
if [[ ${{ runner.os }} == 'Windows' ]]; then
169+
libxml2_root=$(echo "$libxml2_root" | sed 's/\\/\//g')
170+
libxml2_root=$(echo $libxml2_root | sed 's|^/d/|D:/|')
171+
echo "$libxml2_root"
172+
fi
173+
echo -E "libxml2-root=$libxml2_root" >> $GITHUB_OUTPUT
174+
150175
- name: LLVM Parameters
151176
id: llvm-parameters
152177
run: |
@@ -229,6 +254,8 @@ jobs:
229254
-D duktape_ROOT=${{ steps.duktape-install.outputs.duktape-root }}
230255
-D Duktape_ROOT=${{ steps.duktape-install.outputs.duktape-root }}
231256
-D fmt_ROOT=${{ steps.fmt-install.outputs.fmt-root }}
257+
-D libxml2_ROOT=${{ steps.libxml2-install.outputs.libxml2-root }}
258+
-D LibXml2_ROOT=${{ steps.libxml2-install.outputs.libxml2-root }}
232259
export-compile-commands: true
233260
run-tests: true
234261
install: true

docs/modules/ROOT/pages/install.adoc

+59-32
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ cd ..
5656
----
5757
5858
<.> Shallow clones the fmt repository.
59-
<.> Configure the fmt library with CMake, exclusing the documentation and tests.
59+
<.> Configure the fmt library with CMake, excluding the documentation and tests.
6060
<.> Builds the fmt library in the `build` directory.
6161
<.> Installs the fmt library in the `install` directory.
6262
@@ -80,7 +80,7 @@ Windows PowerShell::
8080
git clone https://github.com/microsoft/vcpkg.git -b master <.>
8181
cd vcpkg
8282
bootstrap-vcpkg.bat <.>
83-
vcpkg.exe fmt --triplet x64-windows <.>
83+
vcpkg.exe install fmt --triplet x64-windows <.>
8484
----
8585
8686
<.> Clones the Vcpkg repository.
@@ -96,7 +96,7 @@ Unix Variants::
9696
git clone https://github.com/microsoft/vcpkg.git -b master <.>
9797
cd vcpkg
9898
./bootstrap-vcpkg.sh <.>
99-
./vcpkg fmt <.>
99+
./vcpkg install fmt <.>
100100
----
101101
102102
<.> Clones the Vcpkg repository.
@@ -217,7 +217,7 @@ Windows PowerShell::
217217
[source,bash]
218218
----
219219
cd vcpkg
220-
vcpkg.exe duktape --triplet x64-windows <.>
220+
vcpkg.exe install duktape --triplet x64-windows <.>
221221
----
222222
223223
<.> Installs the `duktape` library.
@@ -229,7 +229,7 @@ Unix Variants::
229229
[source,bash]
230230
----
231231
cd vcpkg
232-
./vcpkg duktape <.>
232+
./vcpkg install duktape <.>
233233
----
234234
235235
<.> Installs the `duktape` library.
@@ -238,6 +238,60 @@ cd vcpkg
238238

239239
NOTE: These examples assume VcPkg is already installed in the `third-party/vcpkg` directory (see the <<install-fmt>> section).
240240

241+
=== Libxml2
242+
243+
MrDocs uses `libxml2` tools for tests.
244+
Only developers need to install this dependency.
245+
Users can skip this step.
246+
247+
From the `third-party` directory, you can clone the `libxml2` repository and install it with the following commands:
248+
249+
[source,bash]
250+
----
251+
git clone https://github.com/GNOME/libxml2 --branch v2.12.6 --depth 1 <.>
252+
cd libxml2
253+
cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DLIBXML2_WITH_PROGRAMS=ON -DLIBXML2_WITH_FTP=OFF -DLIBXML2_WITH_HTTP=OFF -DLIBXML2_WITH_ICONV=OFF -DLIBXML2_WITH_LEGACY=OFF -DLIBXML2_WITH_LZMA=OFF -DLIBXML2_WITH_ZLIB=OFF -DLIBXML2_WITH_ICU=OFF -DLIBXML2_WITH_TESTS=OFF -DLIBXML2_WITH_HTML=ON -DLIBXML2_WITH_C14N=ON -DLIBXML2_WITH_CATALOG=ON -DLIBXML2_WITH_DEBUG=ON -DLIBXML2_WITH_ISO8859X=ON -DLIBXML2_WITH_MEM_DEBUG=OFF -DLIBXML2_WITH_MODULES=ON -DLIBXML2_WITH_OUTPUT=ON -DLIBXML2_WITH_PATTERN=ON -DLIBXML2_WITH_PUSH=ON -DLIBXML2_WITH_PYTHON=OFF -DLIBXML2_WITH_READER=ON -DLIBXML2_WITH_REGEXPS=ON -DLIBXML2_WITH_SAX1=ON -DLIBXML2_WITH_SCHEMAS=ON -DLIBXML2_WITH_SCHEMATRON=ON -DLIBXML2_WITH_THREADS=ON -DLIBXML2_WITH_THREAD_ALLOC=OFF -DLIBXML2_WITH_TREE=ON -DLIBXML2_WITH_VALID=ON -DLIBXML2_WITH_WRITER=ON -DLIBXML2_WITH_XINCLUDE=ON -DLIBXML2_WITH_XPATH=ON -DLIBXML2_WITH_XPTR=ON <.>
254+
cmake --build ./build --config Release <.>
255+
cmake --install ./build --prefix ./install <.>
256+
cd ..
257+
----
258+
259+
<.> Shallow clones the libxml2 repository.
260+
<.> Configure the libxml2 with CMake, excluding the documentation, tests, and unwanted dependencies.
261+
<.> Builds libxml2 in the `build` directory.
262+
<.> Installs libxml2 in the `install` directory.
263+
264+
If you prefer using Vcpkg to install dependencies, you can install `libxml2` with the following commands from the `third-party` directory:
265+
266+
[tabs]
267+
====
268+
Windows PowerShell::
269+
+
270+
--
271+
[source,bash]
272+
----
273+
cd vcpkg
274+
vcpkg.exe install libxml2[tools] --triplet x64-windows <.>
275+
----
276+
277+
<.> Installs `libxml2`.
278+
--
279+
280+
Unix Variants::
281+
+
282+
--
283+
[source,bash]
284+
----
285+
cd vcpkg
286+
./vcpkg install libxml2[tools] <.>
287+
----
288+
289+
<.> Installs `libxml2`.
290+
--
291+
====
292+
293+
NOTE: These examples assume VcPkg is already installed in the `third-party/vcpkg` directory (see the <<install-fmt>> section).
294+
241295
=== LLVM
242296

243297
MrDocs uses LLVM to parse C++ code and extract documentation from it.
@@ -333,33 +387,6 @@ Return from `./third-party/llvm-project/llvm` to the parent directory to build a
333387
cd ../../..
334388
----
335389

336-
=== Libxml2
337-
338-
Developers should also install the `libxml2` tools to parse XML files.
339-
This tool is used in tests.
340-
You can install the libxml2 tools with Vcpkg:
341-
342-
[tabs]
343-
====
344-
Windows PowerShell::
345-
+
346-
--
347-
[source,bash]
348-
----
349-
vcpkg.exe libxml2[tools] --triplet x64-windows
350-
----
351-
--
352-
353-
Unix Variants::
354-
+
355-
--
356-
[source,bash]
357-
----
358-
./vcpkg libxml2[tools]
359-
----
360-
--
361-
====
362-
363390
=== MrDocs
364391

365392
Return from `./third-party/vcpkg` to the parent directory of `third-party` (the one containing the `mrdocs` directory) to build and install MrDocs:

0 commit comments

Comments
 (0)