From 2e1fa4ff49f592321ca92b080ec2d81190633d44 Mon Sep 17 00:00:00 2001
From: Vladimir Stoiakin <VStoiakin@lavabit.com>
Date: Sun, 31 May 2020 16:34:19 +0300
Subject: [PATCH] meson: add libarchive

Change-Id: Id45fe5976a1eb957e5b19777c724bac06d2dd92a
---
 meson.build                 | 16 ++++++++++++++++
 src/meson.build             |  1 +
 subprojects/libarchive.wrap |  6 ++++++
 3 files changed, 23 insertions(+)
 create mode 100644 subprojects/libarchive.wrap

diff --git a/meson.build b/meson.build
index 9d4d68969b..9b8c905c82 100644
--- a/meson.build
+++ b/meson.build
@@ -29,6 +29,8 @@ depspeexdsp = dependency('speexdsp')
 depyamlcpp = dependency('yaml-cpp', version: '>= 0.5.1', required: false)
 if not depyamlcpp.found()
     depyamlcpp = modcmake.subproject('yaml-cpp', cmake_options: [
+        '-DCMAKE_BUILD_TYPE=Release',
+        '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
         '-DYAML_CPP_BUILD_TOOLS=OFF',
         '-DYAML_CPP_BUILD_TESTS=OFF',
         '-DYAML_CPP_BUILD_CONTRIB=OFF',
@@ -36,6 +38,20 @@ if not depyamlcpp.found()
     ]).dependency('yaml-cpp')
 endif
 
+deplibarchive = dependency('libarchive', version: '>= 3.4.0', required: false)
+if not deplibarchive.found()
+    deplibarchive = modcmake.subproject('libarchive', cmake_options: [
+        '-DCMAKE_BUILD_TYPE=Release',
+        '-DCMAKE_INSTALL_LIBDIR=lib',
+        '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
+        '-DENABLE_TEST=OFF',
+        '-DENABLE_TAR=OFF',
+        '-DENABLE_CPIO=OFF',
+        '-DENABLE_CAT=OFF',
+        '-DENABLE_LIBXML2=OFF'
+    ]).dependency('archive_static')
+endif
+
 depjsoncpp = dependency('jsoncpp', version: '>= 1.6.5',
                         fallback: ['jsoncpp', 'jsoncpp_dep'], default_options: ['default_library=static'])
 depzlib = dependency('zlib', fallback: ['zlib', 'zlib_dep'], default_options: ['default_library=static'])
diff --git a/src/meson.build b/src/meson.build
index 2a82eabe56..c0859718a5 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -133,6 +133,7 @@ libjami_dependencies = [
     depspeex,
     depspeexdsp,
     depyamlcpp,
+    deplibarchive,
     depjsoncpp,
     depzlib
 ]
diff --git a/subprojects/libarchive.wrap b/subprojects/libarchive.wrap
new file mode 100644
index 0000000000..24898ce13a
--- /dev/null
+++ b/subprojects/libarchive.wrap
@@ -0,0 +1,6 @@
+[wrap-file]
+directory = libarchive-3.4.3
+
+source_url = https://github.com/libarchive/libarchive/releases/download/v3.4.3/libarchive-3.4.3.tar.gz
+source_filename = libarchive-3.4.3.tar.gz
+source_hash = ee1e749213c108cb60d53147f18c31a73d6717d7e3d2481c157e1b34c881ea39
-- 
GitLab