pkg-config (#157)

Closes #43
This commit is contained in:
Alex Kotov 2022-12-23 12:28:52 +04:00 committed by GitHub
parent b812b52a9c
commit 4d493ba3df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 48 additions and 8 deletions

2
.gitignore vendored
View File

@ -81,3 +81,5 @@
/libc/Makefile
/libc/include/Makefile
/tests/Makefile
/libkernaux.pc

View File

@ -1,3 +1,7 @@
2022-12-23 Alex Kotov <kotovalexarian@gmail.com>
* configure.ac: Feature "--(enable|disable)-pkg-config" has been added
2022-12-22 Alex Kotov <kotovalexarian@gmail.com>
* include/kernaux/memmap.h: Complete rewrite

View File

@ -28,6 +28,11 @@ AM_CFLAGS += -DKERNAUX_ACCESS_PRIVATE
lib_LTLIBRARIES = libkernaux.la
if ENABLE_PKG_CONFIG
pkgconfigdir = @pkgconfdir@
pkgconfig_DATA = libkernaux.pc
endif
##################
# Required files #
##################

View File

@ -43,9 +43,9 @@ zero). Work-in-progress APIs can change at any time.
* [Runtime environment](/include/kernaux/runtime.h) (*non-breaking since* **?.?.?**)
* [Macros](/include/kernaux/macro.h) (*non-breaking since* **0.6.0**)
* [Example: packing](/examples/macro_packing.c)
* [Example: BITS](/examples/macro_bits.c)
* [Example: CAST\_\*](/examples/macro_cast.c);
* [Example: CONTAINER\_OF](/examples/macro_container_of.c)
* [Example: BITS](/examples/macro_bits.c)
* [Example: STATIC\_TEST\*](/examples/macro_static_test.c)
* Stack trace *(planned)*
* Generic types
@ -140,6 +140,8 @@ stable options.
* `--enable-checks-python` - enable tests that require Python 3 with YAML and
Jinja2
* `--enable-fixtures` - enable fixtures for tests and bindings
* `--enable-pkg-config[=PATH]` - install pkg-config files
[PATH='${libdir}/pkgconfig']
#### Packages

View File

@ -25,6 +25,7 @@ AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([src/runtime.c])
AC_CONFIG_FILES([
Makefile
libkernaux.pc
examples/Makefile
fixtures/Makefile
fixtures/multiboot2_bin_examples_gen.c
@ -39,6 +40,7 @@ AC_CONFIG_FILES([
AM_INIT_AUTOMAKE([1.16 subdir-objects])
AC_SUBST([PACKAGE_DESCR], ['Auxiliary library for kernel development'])
AC_SUBST([PACKAGE_VERSION_SO], m4_normalize(m4_include([VERSION_SO])))
@ -55,12 +57,15 @@ AC_ARG_ENABLE([werror], AS_HELP_STRING([--disable-werror], [dis
dnl Features (disabled by default)
AC_ARG_ENABLE([fixtures], AS_HELP_STRING([--enable-fixtures], [enable fixtures for tests and bindings]))
AC_ARG_ENABLE([freestanding], AS_HELP_STRING([--enable-freestanding], [build for freestanding environment]))
AC_ARG_ENABLE([split-libc], AS_HELP_STRING([--enable-split-libc], [split off libc]))
AC_ARG_ENABLE([checks], AS_HELP_STRING([--enable-checks], [enable usual tests and examples]))
AC_ARG_ENABLE([checks-all], AS_HELP_STRING([--enable-checks-all], [enable all checks]))
AC_ARG_ENABLE([checks-cppcheck], AS_HELP_STRING([--enable-checks-cppcheck], [enable cppcheck]))
AC_ARG_ENABLE([checks-pthreads], AS_HELP_STRING([--enable-checks-pthreads], [enable tests that require pthreads]))
AC_ARG_ENABLE([checks-python], AS_HELP_STRING([--enable-checks-python], [enable tests that require Python 3 with YAML and Jinja2]))
AC_ARG_ENABLE([split-libc], AS_HELP_STRING([--enable-split-libc], [split off libc]))
dnl Features (with parameter)
AC_ARG_ENABLE([pkg-config], AS_HELP_STRING([--enable-pkg-config@<:@=PATH@:>@], [install pkg-config files @<:@PATH='${libdir}/pkgconfig'@:>@]))
dnl Packages (enabled by default)
AC_ARG_WITH( [all], AS_HELP_STRING([--without-all], [without all default packages]))
@ -141,12 +146,16 @@ AS_IF([test "$enable_werror" = no ], [enable_werror=no], [ena
dnl Features (disabled by default)
AS_IF([test "$enable_fixtures" = yes], [enable_fixtures=yes], [enable_fixtures=no])
AS_IF([test "$enable_freestanding" = yes], [enable_freestanding=yes], [enable_freestanding=no])
AS_IF([test "$enable_split_libc" = yes], [enable_split_libc=yes], [enable_split_libc=no])
AS_IF([test "$enable_checks" = yes], [enable_checks=yes], [enable_checks=no])
AS_IF([test "$enable_checks_all" = yes], [enable_checks_all=yes], [enable_checks_all=no])
AS_IF([test "$enable_checks_cppcheck" = yes], [enable_checks_cppcheck=yes], [enable_checks_cppcheck=no])
AS_IF([test "$enable_checks_pthreads" = yes], [enable_checks_pthreads=yes], [enable_checks_pthreads=no])
AS_IF([test "$enable_checks_python" = yes], [enable_checks_python=yes], [enable_checks_python=no])
AS_IF([test "$enable_split_libc" = yes], [enable_split_libc=yes], [enable_split_libc=no])
dnl Features (with parameter)
AS_IF([test "$enable_pkg_config" = yes], [enable_pkg_config='${libdir}/pkgconfig'])
AS_IF([test "$enable_pkg_config" = no ], [enable_pkg_config=''])
dnl Packages (enabled by default)
AS_IF([test "$with_all" = no ], [with_all=no], [with_all=yes])
@ -207,11 +216,14 @@ AM_CONDITIONAL([ENABLE_WERROR], [test "$enable_werror" = yes])
dnl Features (disabled by default)
AM_CONDITIONAL([ENABLE_FIXTURES], [test "$enable_fixtures" = yes])
AM_CONDITIONAL([ENABLE_FREESTANDING], [test "$enable_freestanding" = yes])
AM_CONDITIONAL([ENABLE_SPLIT_LIBC], [test "$enable_split_libc" = yes])
AM_CONDITIONAL([ENABLE_CHECKS], [test "$enable_checks" = yes])
AM_CONDITIONAL([ENABLE_CHECKS_CPPCHECK], [test "$enable_checks_cppcheck" = yes])
AM_CONDITIONAL([ENABLE_CHECKS_PTHREADS], [test "$enable_checks_pthreads" = yes])
AM_CONDITIONAL([ENABLE_CHECKS_PYTHON], [test "$enable_checks_python" = yes])
AM_CONDITIONAL([ENABLE_SPLIT_LIBC], [test "$enable_split_libc" = yes])
dnl Features (with parameter)
AM_CONDITIONAL([ENABLE_PKG_CONFIG], [test ! -z "$enable_pkg_config"])
dnl Packages (enabled by default)
AM_CONDITIONAL([WITH_ARCH_I386], [test "$with_arch_i386" = yes])
@ -257,13 +269,13 @@ AS_IF([test "$enable_float" = yes], [AC_DEFINE([ENABLE_FLOAT],
AS_IF([test "$enable_werror" = yes], [AC_DEFINE([ENABLE_WERROR], [1], [enabled -Werror])])
dnl Features (disabled by default)
AS_IF([test "$enable_split_libc" = yes], [AC_DEFINE([ENABLE_SPLIT_LIBC], [1], [split off libc])])
AS_IF([test "$enable_fixtures" = yes], [AC_DEFINE([ENABLE_FIXTURES], [1], [enabled fixtures for tests and bindings])])
AS_IF([test "$enable_freestanding" = yes], [AC_DEFINE([ENABLE_FREESTANDING], [1], [build for freestanding environment])])
AS_IF([test "$enable_checks" = yes], [AC_DEFINE([ENABLE_CHECKS], [1], [enabled usual tests and examples])])
AS_IF([test "$enable_checks_cppcheck" = yes], [AC_DEFINE([ENABLE_CHECKS_CPPCHECK], [1], [enabled cppcheck])])
AS_IF([test "$enable_checks_pthreads" = yes], [AC_DEFINE([ENABLE_CHECKS_PTHREADS], [1], [enabled tests that require pthreads])])
AS_IF([test "$enable_checks_python" = yes], [AC_DEFINE([ENABLE_CHECKS_PYTHON], [1], [enabled tests that require Python 3 with YAML and Jinja2])])
AS_IF([test "$enable_split_libc" = yes], [AC_DEFINE([ENABLE_SPLIT_LIBC], [1], [split off libc])])
dnl Packages (enabled by default)
AS_IF([test "$with_arch_i386" = yes], [AC_DEFINE([WITH_ARCH_I386], [1], [with architecture i386])])
@ -295,6 +307,9 @@ AS_IF([test "$with_arch_x86_64" = yes], [AC_DEFINE([WITH_ARCH_X86],
# Autoconf substitutions #
##########################
dnl Features (with parameter)
AC_SUBST([pkgconfdir], [$enable_pkg_config])
dnl Packages (enabled by default)
AS_IF([test "$with_arch_i386" = no], [AC_SUBST([comment_line_arch_i386], [//])])
AS_IF([test "$with_arch_riscv64" = no], [AC_SUBST([comment_line_arch_riscv64], [//])])

11
libkernaux.pc.in Normal file
View File

@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: @PACKAGE_NAME@
Description: @PACKAGE_DESCR@
URL: @PACKAGE_URL@
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lkernaux
Cflags: -I${includedir}

View File

@ -10,9 +10,10 @@ WWW= https://github.com/tailix/libkernaux
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/COPYING
USES= libtool
USE_LDCONFIG= yes
GNU_CONFIGURE= yes
USES= libtool
USE_LDCONFIG= yes
GNU_CONFIGURE= yes
CONFIGURE_ARGS+= --enable-shared
.include <bsd.port.mk>