From 827f638be62edc7234d8815f4cf80ccb0ecf4005 Mon Sep 17 00:00:00 2001 From: supdrewin <84341772+supdrewin@users.noreply.github.com> Date: Thu, 20 Jan 2022 03:42:11 +0800 Subject: [PATCH] Turn subproject as fallback (#1) Use system-wide INIReader if available or fallback to use subproject --- src/pam/README.md | 26 ++++++++++++++++++++------ src/pam/meson.build | 21 ++++++++++++++++----- src/pam/subprojects/inih.wrap | 2 +- 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/pam/README.md b/src/pam/README.md index 765cba8..d8a3b53 100644 --- a/src/pam/README.md +++ b/src/pam/README.md @@ -1,20 +1,34 @@ # Howdy PAM module +## Prepare + +Howdy PAM module depends on `INIReader`. + +If you are building a distro package, +there is a list for it below: + +``` +Arch Linux - libinih +Debian - libinih-dev +Fedora - inih-devel +OpenSUSE - inih +``` + ## Build -```sh -meson setup build -Dinih:with_INIReader=true +``` sh +meson setup build meson compile -C build ``` ## Install -```sh -sudo mv build/libpam_howdy.so /lib/security/pam_howdy.so +``` sh +sudo meson install -C build ``` Change PAM config line to: -```pam -auth sufficient pam_howdy.so +``` pam +auth sufficient pam_howdy.so ``` diff --git a/src/pam/meson.build b/src/pam/meson.build index add0595..fe2d09a 100644 --- a/src/pam/meson.build +++ b/src/pam/meson.build @@ -1,9 +1,20 @@ project('pam_howdy', 'cpp', version: '0.1.0', default_options: ['cpp_std=c++14']) -inih = subproject('inih') -inih_cpp = inih.get_variable('INIReader_dep') - -libpam = meson.get_compiler('c').find_library('pam') boost = dependency('boost', modules: ['locale']) +inih_cpp = dependency('INIReader', fallback: ['inih', 'INIReader_dep']) +libpam = meson.get_compiler('cpp').find_library('pam') threads = dependency('threads') -shared_library('pam_howdy', 'main.cc', dependencies: [boost, libpam, inih_cpp, threads], install: true, install_dir: '/lib/security/') + +shared_library( + 'pam_howdy', + 'main.cc', + dependencies: [ + boost, + libpam, + inih_cpp, + threads + ], + install: true, + install_dir: '/lib/security', + name_prefix: '' +) diff --git a/src/pam/subprojects/inih.wrap b/src/pam/subprojects/inih.wrap index 8d02b50..f1c71a4 100644 --- a/src/pam/subprojects/inih.wrap +++ b/src/pam/subprojects/inih.wrap @@ -1,3 +1,3 @@ [wrap-git] url = https://github.com/benhoyt/inih.git -revision = r52 +revision = head