diff --git a/.travis.yml b/.travis.yml index 508407fa21..51fee28a54 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,6 @@ jobs: apt: packages: - ninja-build - - libarchive-dev install: - source ~/virtualenv/python3.6/bin/activate - pip install meson @@ -32,7 +31,6 @@ jobs: packages: - ninja - llvm - - libarchive update: true script: - xcodebuild -project iSH.xcodeproj -scheme iSH -sdk iphoneos CODE_SIGNING_ALLOWED=NO diff --git a/README.md b/README.md index 07ecc05e60..d850e310b3 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ You'll need these things to build the project: - Meson (`pip install meson`) - Clang and LLD (on mac, `brew install llvm`, on linux, `sudo apt install clang lld` or `sudo pacman -S clang lld` or whatever) - sqlite3 (this is so common it may already be installed on linux and is definitely already installed on mac. if not, do something like `sudo apt install libsqlite3-dev`) + - Either libarchive (from your package manager) or cmake (to build a bundled libarchive) ## Build for iOS diff --git a/deps/script/meson.build b/deps/script/meson.build new file mode 100644 index 0000000000..7f62484bbe --- /dev/null +++ b/deps/script/meson.build @@ -0,0 +1,14 @@ +libarchive = dependency('libarchive', method: 'pkg-config', required: false) +if not libarchive.found() + # try homebrew + libarchive_lib = cc.find_library('libarchive', dirs: ['/usr/local/opt/libarchive/lib'], required: false) + if libarchive_lib.found() + libarchive = declare_dependency(dependencies: [libarchive_lib], include_directories: include_directories(['/usr/local/opt/libarchive/include'])) + endif +endif +if not libarchive.found() + warning('no system libarchive found, building with cmake') + cmake = import('cmake') + libarchive = cmake.subproject('libarchive').dependency('archive_static') +endif + diff --git a/meson.build b/meson.build index c8a0408b89..0f8841e350 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,6 @@ project('ish', 'c', - default_options: ['default_library=static', 'c_std=gnu11', 'warning_level=2']) + default_options: ['default_library=static', 'c_std=gnu11', 'warning_level=2'], + subproject_dir: 'deps') cc = meson.get_compiler('c') if cc.get_id() == 'clang' @@ -34,6 +35,7 @@ threads = dependency('threads') librt = cc.find_library('rt', required: false) libm = cc.find_library('m', required: false) sqlite3 = cc.find_library('sqlite3') +subdir('deps/script') dependencies = [librt, libm, threads, sqlite3] diff --git a/tools/meson.build b/tools/meson.build index 37e4818ab9..2c7e684e5b 100644 --- a/tools/meson.build +++ b/tools/meson.build @@ -19,19 +19,8 @@ if unicorn.found() configure_file(input: 'ptraceomatic-gdb.gdb', output: 'unicornomatic-gdb.gdb', copy: true) endif -libarchive = dependency('libarchive', required: false) -if not libarchive.found() - # homebrew - libarchive_lib = cc.find_library('libarchive', dirs: ['/usr/local/opt/libarchive/lib'], required: false) - if libarchive_lib.found() - libarchive = declare_dependency(dependencies: [libarchive_lib], include_directories: include_directories(['/usr/local/opt/libarchive/include'])) - endif -endif - -if libarchive.found() - fakefsify = executable('fakefsify', ['fakefsify.c', 'fakefs.c'], dependencies: [ish, libarchive]) - custom_target('unfakefsify', - build_by_default: true, - command: ['ln', '-sf', 'fakefsify', '@OUTPUT@'], - output: 'unfakefsify') -endif +fakefsify = executable('fakefsify', ['fakefsify.c', 'fakefs.c'], dependencies: [ish, libarchive]) +custom_target('unfakefsify', + build_by_default: true, + command: ['ln', '-sf', 'fakefsify', '@OUTPUT@'], + output: 'unfakefsify')