Skip to content

Commit

Permalink
ci: use official libxml2 release
Browse files Browse the repository at this point in the history
This extends the same logic of other dependencies and avoids bugs in the vcpkg port.
  • Loading branch information
alandefreitas committed Apr 3, 2024
1 parent 0771bdc commit ab43756
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 33 deletions.
29 changes: 28 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ jobs:
TZ: 'Etc/UTC'
with:
apt-get: ${{ matrix.install }} git build-essential python3 curl openjdk-11-jdk ninja-build pkg-config libncurses-dev
vcpkg: libxml2[tools]
cc: ${{ steps.setup-cpp.outputs.cc || matrix.cc }}
ccflags: ${{ matrix.ccflags }}
cxx: ${{ steps.setup-cpp.outputs.cxx || matrix.cxx }}
Expand Down Expand Up @@ -147,6 +146,32 @@ jobs:
fi
echo -E "duktape-root=$duktape_root" >> $GITHUB_OUTPUT
- name: Install Libxml2
id: libxml2-install
shell: bash
run: |
set -x
cd ..
mkdir -p third-party
cd third-party
git config --global init.defaultBranch master
git config --global advice.detachedHead false
git clone https://github.com/GNOME/libxml2 --branch v2.12.6 --depth 1
cd libxml2
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 }}
N_CORES=$(nproc 2>/dev/null || echo 1)
cmake --build ./build --config ${{ matrix.build-type }} --parallel $N_CORES
cmake --install ./build --prefix ./install
libxml2_root=$(pwd)/install
if [[ ${{ runner.os }} == 'Windows' ]]; then
libxml2_root=$(echo "$libxml2_root" | sed 's/\\/\//g')
libxml2_root=$(echo $libxml2_root | sed 's|^/d/|D:/|')
echo "$libxml2_root"
fi
echo -E "libxml2-root=$libxml2_root" >> $GITHUB_OUTPUT
- name: LLVM Parameters
id: llvm-parameters
run: |
Expand Down Expand Up @@ -229,6 +254,8 @@ jobs:
-D duktape_ROOT=${{ steps.duktape-install.outputs.duktape-root }}
-D Duktape_ROOT=${{ steps.duktape-install.outputs.duktape-root }}
-D fmt_ROOT=${{ steps.fmt-install.outputs.fmt-root }}
-D libxml2_ROOT=${{ steps.libxml2-install.outputs.libxml2-root }}
-D LibXml2_ROOT=${{ steps.libxml2-install.outputs.libxml2-root }}
export-compile-commands: true
run-tests: true
install: true
Expand Down
91 changes: 59 additions & 32 deletions docs/modules/ROOT/pages/install.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ cd ..
----
<.> Shallow clones the fmt repository.
<.> Configure the fmt library with CMake, exclusing the documentation and tests.
<.> Configure the fmt library with CMake, excluding the documentation and tests.
<.> Builds the fmt library in the `build` directory.
<.> Installs the fmt library in the `install` directory.
Expand All @@ -80,7 +80,7 @@ Windows PowerShell::
git clone https://github.com/microsoft/vcpkg.git -b master <.>
cd vcpkg
bootstrap-vcpkg.bat <.>
vcpkg.exe fmt --triplet x64-windows <.>
vcpkg.exe install fmt --triplet x64-windows <.>
----
<.> Clones the Vcpkg repository.
Expand All @@ -96,7 +96,7 @@ Unix Variants::
git clone https://github.com/microsoft/vcpkg.git -b master <.>
cd vcpkg
./bootstrap-vcpkg.sh <.>
./vcpkg fmt <.>
./vcpkg install fmt <.>
----
<.> Clones the Vcpkg repository.
Expand Down Expand Up @@ -217,7 +217,7 @@ Windows PowerShell::
[source,bash]
----
cd vcpkg
vcpkg.exe duktape --triplet x64-windows <.>
vcpkg.exe install duktape --triplet x64-windows <.>
----
<.> Installs the `duktape` library.
Expand All @@ -229,7 +229,7 @@ Unix Variants::
[source,bash]
----
cd vcpkg
./vcpkg duktape <.>
./vcpkg install duktape <.>
----
<.> Installs the `duktape` library.
Expand All @@ -238,6 +238,60 @@ cd vcpkg

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

=== Libxml2

MrDocs uses `libxml2` tools for tests.
Only developers need to install this dependency.
Users can skip this step.

From the `third-party` directory, you can clone the `libxml2` repository and install it with the following commands:

[source,bash]
----
git clone https://github.com/GNOME/libxml2 --branch v2.12.6 --depth 1 <.>
cd libxml2
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 <.>
cmake --build ./build --config Release <.>
cmake --install ./build --prefix ./install <.>
cd ..
----

<.> Shallow clones the libxml2 repository.
<.> Configure the libxml2 with CMake, excluding the documentation, tests, and unwanted dependencies.
<.> Builds libxml2 in the `build` directory.
<.> Installs libxml2 in the `install` directory.

If you prefer using Vcpkg to install dependencies, you can install `libxml2` with the following commands from the `third-party` directory:

[tabs]
====
Windows PowerShell::
+
--
[source,bash]
----
cd vcpkg
vcpkg.exe install libxml2[tools] --triplet x64-windows <.>
----
<.> Installs `libxml2`.
--
Unix Variants::
+
--
[source,bash]
----
cd vcpkg
./vcpkg install libxml2[tools] <.>
----
<.> Installs `libxml2`.
--
====

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

=== LLVM

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

=== Libxml2

Developers should also install the `libxml2` tools to parse XML files.
This tool is used in tests.
You can install the libxml2 tools with Vcpkg:

[tabs]
====
Windows PowerShell::
+
--
[source,bash]
----
vcpkg.exe libxml2[tools] --triplet x64-windows
----
--
Unix Variants::
+
--
[source,bash]
----
./vcpkg libxml2[tools]
----
--
====

=== MrDocs

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

0 comments on commit ab43756

Please sign in to comment.