Skip to content

Commit

Permalink
Build docoptcpp using Meson
Browse files Browse the repository at this point in the history
  • Loading branch information
mgautierfr committed Aug 27, 2024
1 parent a7f42fc commit 93d3fdd
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 8 deletions.
26 changes: 18 additions & 8 deletions kiwixbuild/dependencies/docoptcpp.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
from .base import Dependency, GitClone, CMakeBuilder
from .base import Dependency, ReleaseDownload, MesonBuilder

from kiwixbuild.utils import Remotefile


class docoptcpp(Dependency):
name = "docoptcpp"

class Source(GitClone):
git_remote = "https://github.com/docopt/docopt.cpp.git"
git_dir = "docopt.cpp"
force_full_clone = True
git_ref = "3dd23e3280f213bacefdf5fcb04857bf52e90917"
class Source(ReleaseDownload):
name = "docoptcpp"
src_archive = Remotefile(
"v0.6.3.tar.gz",
"28af5a0c482c6d508d22b14d588a3b0bd9ff97135f99c2814a5aa3cbff1d6632",
"https://github.com/docopt/docopt.cpp/archive/v0.6.3.tar.gz",
)

class Builder(CMakeBuilder):
make_install_targets = ["install"]
meson_archive = Remotefile(
"docopt_0.6.3-3_patch.zip",
"1f641187f9d3f35b0a5ebd2011876ef8e9b04b69b7b163095dd7dfa16219ad01",
"https://wrapdb.mesonbuild.com/v2/docopt_0.6.3-3/get_patch",
)

archives = [src_archive, meson_archive]
patches = ["docopt_meson_install_pkgconfig.patch"]

Builder = MesonBuilder
31 changes: 31 additions & 0 deletions kiwixbuild/patches/docopt_meson_install_pkgconfig.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff '--color=auto' -ur docoptcpp-0.6.2/meson.build docoptcpp-0.6.2_patched/meson.build
--- docoptcpp-0.6.2/meson.build 2024-08-26 14:28:47.553448529 +0200
+++ docoptcpp-0.6.2_patched/meson.build 2024-08-26 14:10:47.232603427 +0200
@@ -10,11 +10,25 @@

# bug with missing dllexport. fixed in next version.
if cpp.get_argument_syntax() == 'msvc'
- doclib = static_library('docopt', 'docopt.cpp')
+ doclib = static_library('docopt', 'docopt.cpp', install: true)
else
- doclib = library('docopt', 'docopt.cpp')
+ doclib = library('docopt', 'docopt.cpp', install: true)
endif

executable('docopt_example', 'examples/naval_fate.cpp', link_with: doclib)
docopt_dep = declare_dependency(include_directories: include_directories('.'),
link_with: doclib)
+
+install_headers(
+ 'docopt.h',
+ 'docopt_value.h',
+ subdir: 'docopt'
+)
+
+pkg_mod = import('pkgconfig')
+pkg_mod.generate(
+ doclib,
+ version: meson.project_version(),
+ name: 'docopt',
+ filebase: 'docopt'
+)

0 comments on commit 93d3fdd

Please sign in to comment.