diff options
author | jade <lix@jade.fyi> | 2024-05-23 23:19:28 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@lix-systems> | 2024-05-23 23:19:28 +0000 |
commit | 9530b7f2b2b653fc11753ce452636896350324ff (patch) | |
tree | 837593bceacff5f2760594c5a115242ec63ddca9 | |
parent | 677cf75473d0dd86119c4535d8733a6a0b1100c0 (diff) | |
parent | c97e17144e0d0b666d7b79d8b4b0d581bfdf373b (diff) |
Merge "packaging: rename nixexpr -> lixexpr and so on" into main
-rw-r--r-- | doc/manual/rl-next/rename-lixexpr.md | 31 | ||||
-rw-r--r-- | doc/manual/src/contributing/hacking.md | 4 | ||||
-rw-r--r-- | meson.build | 16 | ||||
-rwxr-xr-x | meson/cleanup-install.bash | 2 | ||||
-rw-r--r-- | package.nix | 4 | ||||
-rw-r--r-- | perl/lib/Nix/meson.build | 2 | ||||
-rw-r--r-- | perl/meson.build | 2 | ||||
-rw-r--r-- | src/libcmd/lix-cmd.pc.in | 10 | ||||
-rw-r--r-- | src/libcmd/meson.build | 10 | ||||
-rw-r--r-- | src/libcmd/nix-cmd.pc.in | 9 | ||||
-rw-r--r-- | src/libexpr/flake/meson.build | 2 | ||||
-rw-r--r-- | src/libexpr/lix-expr.pc.in | 10 | ||||
-rw-r--r-- | src/libexpr/meson.build | 14 | ||||
-rw-r--r-- | src/libexpr/nix-expr.pc.in | 10 | ||||
-rw-r--r-- | src/libfetchers/lix-fetchers.pc.in | 10 | ||||
-rw-r--r-- | src/libfetchers/meson.build | 18 | ||||
-rw-r--r-- | src/libmain/lix-main.pc.in | 10 | ||||
-rw-r--r-- | src/libmain/meson.build | 8 | ||||
-rw-r--r-- | src/libmain/nix-main.pc.in | 9 | ||||
-rw-r--r-- | src/libstore/lix-store.pc.in | 10 | ||||
-rw-r--r-- | src/libstore/meson.build | 10 | ||||
-rw-r--r-- | src/libstore/nix-store.pc.in | 9 | ||||
-rw-r--r-- | src/libutil/lix-util.pc.in | 10 | ||||
-rw-r--r-- | src/libutil/meson.build | 18 | ||||
-rw-r--r-- | src/lix-base.pc.in | 8 | ||||
-rw-r--r-- | tests/unit/meson.build | 12 |
26 files changed, 181 insertions, 77 deletions
diff --git a/doc/manual/rl-next/rename-lixexpr.md b/doc/manual/rl-next/rename-lixexpr.md new file mode 100644 index 000000000..698553c7f --- /dev/null +++ b/doc/manual/rl-next/rename-lixexpr.md @@ -0,0 +1,31 @@ +--- +synopsis: Rename all the libraries nixexpr, nixstore, etc to lixexpr, lixstore, etc +credits: jade +category: Breaking Changes +--- + +The Lix C++ API libraries have had the following changes: +- Includes moved from `include/nix/` to `include/lix/` +- `pkg-config` files renamed from `nix-expr` to `lix-expr` and so on. +- Libraries renamed from `libnixexpr.so` to `liblixexpr.so` and so on. + +There are other changes between Nix 2.18 and Lix, since these APIs are not +stable. However, this change in particular is a deliberate compatibility break +to force downstreams linking to Lix to specifically handle Lix and avoid Lix +accidentally getting ensnared in compatibility code for newer CppNix. + +Migration path: + +- expr.hh -> lix/libexpr/expr.hh +- nix/config.h -> lix/config.h + +To apply this migration automatically, remove all `<nix/>` from includes, so `#include <nix/expr.hh>` -> `#include <expr.hh>`. +Then, the correct paths will be resolved from the tangled mess, and the clang-tidy automated fix will work. + +Then run the following for out of tree projects: + +```console +lix_root=$HOME/lix +(cd $lix_root/clang-tidy && nix develop -c 'meson setup build && ninja -C build') +run-clang-tidy -checks='-*,lix-fixincludes' -load=$lix_root/clang-tidy/build/liblix-clang-tidy.so -p build/ -fix src +``` diff --git a/doc/manual/src/contributing/hacking.md b/doc/manual/src/contributing/hacking.md index a8591e7ca..a73d672d4 100644 --- a/doc/manual/src/contributing/hacking.md +++ b/doc/manual/src/contributing/hacking.md @@ -102,14 +102,14 @@ $ meson compile -C build nixexpr All targets may be addressed as their output, relative to the build directory, e.g.: ```bash -$ meson compile -C build src/libexpr/libnixexpr.so +$ meson compile -C build src/libexpr/liblixexpr.so ``` But Meson does not consider intermediate files like object files targets. To build a specific object file, use Ninja directly and specify the output file relative to the build directory: ```bash -$ ninja -C build src/libexpr/libnixexpr.so.p/nixexpr.cc.o +$ ninja -C build src/libexpr/liblixexpr.so.p/nixexpr.cc.o ``` To inspect the canonical source of truth on what the state of the buildsystem configuration is, use: diff --git a/meson.build b/meson.build index 5885905c5..0d59ff751 100644 --- a/meson.build +++ b/meson.build @@ -395,7 +395,21 @@ config_h = configure_file( output : 'config.h', ) -install_headers(config_h, subdir : 'nix') +install_headers(config_h, subdir : 'lix') + +# FIXME: not using the pkg-config module because it creates way too many deps +# while meson migration is in progress, and we want to not include boost here +configure_file( + input : 'src/lix-base.pc.in', + output : 'lix-base.pc', + install_dir : libdir / 'pkgconfig', + configuration : { + 'prefix' : prefix, + 'libdir' : libdir, + 'includedir' : includedir, + 'PACKAGE_VERSION' : meson.project_version(), + }, +) add_project_arguments( # TODO(Qyriad): Yes this is how the autoconf+Make system did it. diff --git a/meson/cleanup-install.bash b/meson/cleanup-install.bash index 3e229cbc6..928edc74a 100755 --- a/meson/cleanup-install.bash +++ b/meson/cleanup-install.bash @@ -47,4 +47,4 @@ fi # Intentionally not using -f. # If these files don't exist then our assumptions have been violated and we should fail. -rm -v "$includedir/nix/parser-tab.cc" "$includedir/nix/lexer-tab.cc" +rm -v "$includedir/lix/libexpr/parser-tab.cc" "$includedir/lix/libexpr/lexer-tab.cc" diff --git a/package.nix b/package.nix index be3bcfb35..ebafa9420 100644 --- a/package.nix +++ b/package.nix @@ -49,7 +49,7 @@ # internal fork of nix-doc providing :doc in the repl lix-doc ? __forDefaults.lix-doc, - pname ? "nix", + pname ? "lix", versionSuffix ? "", officialRelease ? false, # Set to true to build the release notes for the next release. @@ -333,7 +333,7 @@ stdenv.mkDerivation (finalAttrs: { echo "file binary-dist $out/bin/nix" >> $out/nix-support/hydra-build-products '' + lib.optionalString stdenv.isDarwin '' - for lib in libnixutil.dylib libnixexpr.dylib; do + for lib in liblixutil.dylib liblixexpr.dylib; do install_name_tool \ -change "${lib.getLib boost}/lib/libboost_context.dylib" \ "$out/lib/libboost_context.dylib" \ diff --git a/perl/lib/Nix/meson.build b/perl/lib/Nix/meson.build index 6810622e3..1d235b74c 100644 --- a/perl/lib/Nix/meson.build +++ b/perl/lib/Nix/meson.build @@ -27,7 +27,7 @@ perl_libstore = shared_module( ], link_args : [ # Nix doesn't provide a pkg-config file for libutil. - '-lnixutil', + '-llixutil', soname_args, ], install : true, diff --git a/perl/meson.build b/perl/meson.build index 75c7c2c79..4b179da8f 100644 --- a/perl/meson.build +++ b/perl/meson.build @@ -64,6 +64,6 @@ if cxx.get_linker_id() in ['ld.bfd', 'ld.gold'] add_project_link_arguments('-Wl,--no-copy-dt-needed-entries', language : 'cpp') endif -libstore = dependency('nixstore', 'nix-store', required : true) +libstore = dependency('lixstore', 'lix-store', required : true) subdir('lib/Nix') diff --git a/src/libcmd/lix-cmd.pc.in b/src/libcmd/lix-cmd.pc.in new file mode 100644 index 000000000..f2e3f9d5e --- /dev/null +++ b/src/libcmd/lix-cmd.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: Lix (libcmd) +Description: Lix Package Manager (libcmd) +Version: @PACKAGE_VERSION@ +Requires: lix-base lix-util +Libs: -L${libdir} -llixcmd +Cflags: -I${includedir}/lix/libcmd diff --git a/src/libcmd/meson.build b/src/libcmd/meson.build index 5a0e61503..4da1b496b 100644 --- a/src/libcmd/meson.build +++ b/src/libcmd/meson.build @@ -39,7 +39,7 @@ libcmd_generated_headers = [ ] libcmd = library( - 'nixcmd', + 'lixcmd', libcmd_generated_headers, libcmd_sources, dependencies : [ @@ -59,13 +59,13 @@ libcmd = library( install_rpath : libdir, ) -install_headers(libcmd_headers, subdir : 'nix', preserve_path : true) +install_headers(libcmd_headers, subdir : 'lix/libcmd', preserve_path : true) custom_target( command : [ 'cp', '@INPUT@', '@OUTPUT@' ], input : libcmd_generated_headers, output : '@PLAINNAME@', install : true, - install_dir : includedir / 'nix', + install_dir : includedir / 'lix/libcmd', ) liblixcmd = declare_dependency( @@ -76,8 +76,8 @@ liblixcmd = declare_dependency( # FIXME: not using the pkg-config module because it creates way too many deps # while meson migration is in progress, and we want to not include boost here configure_file( - input : 'nix-cmd.pc.in', - output : 'nix-cmd.pc', + input : 'lix-cmd.pc.in', + output : 'lix-cmd.pc', install_dir : libdir / 'pkgconfig', configuration : { 'prefix' : prefix, diff --git a/src/libcmd/nix-cmd.pc.in b/src/libcmd/nix-cmd.pc.in deleted file mode 100644 index 39575f222..000000000 --- a/src/libcmd/nix-cmd.pc.in +++ /dev/null @@ -1,9 +0,0 @@ -prefix=@prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: Nix -Description: Nix Package Manager -Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -lnixcmd -Cflags: -I${includedir}/nix -std=c++2a diff --git a/src/libexpr/flake/meson.build b/src/libexpr/flake/meson.build index 3ecc30f4e..cce1b0c75 100644 --- a/src/libexpr/flake/meson.build +++ b/src/libexpr/flake/meson.build @@ -4,5 +4,5 @@ libexpr_generated_headers += custom_target( output : '@PLAINNAME@.gen.hh', capture : true, install : true, - install_dir : includedir / 'nix/flake', + install_dir : includedir / 'lix/libexpr/flake', ) diff --git a/src/libexpr/lix-expr.pc.in b/src/libexpr/lix-expr.pc.in new file mode 100644 index 000000000..5e850976d --- /dev/null +++ b/src/libexpr/lix-expr.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: Lix libexpr +Description: Lix Package Manager (libexpr) +Version: @PACKAGE_VERSION@ +Requires: lix-base lix-util lix-fetchers lix-store bdw-gc +Libs: -L${libdir} -llixexpr +Cflags: -I${includedir}/lix/libexpr diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build index 099279d56..fda6fde2c 100644 --- a/src/libexpr/meson.build +++ b/src/libexpr/meson.build @@ -15,7 +15,7 @@ parser_tab = custom_target( # NOTE(Qyriad): Meson doesn't support installing only part of a custom target, so we add # an install script below which removes parser-tab.cc. install : true, - install_dir : includedir / 'nix', + install_dir : includedir / 'lix/libexpr', ) lexer_tab = custom_target( @@ -37,7 +37,7 @@ lexer_tab = custom_target( # NOTE(Qyriad): Meson doesn't support installing only part of a custom target, so we add # an install script below which removes lexer-tab.cc. install : true, - install_dir : includedir / 'nix', + install_dir : includedir / 'lix/libexpr', ) # TODO(Qyriad): When the parser and lexer are rewritten this should be removed. @@ -59,7 +59,7 @@ foreach header : [ 'imported-drv-to-derivation.nix', 'fetchurl.nix' ] output : '@PLAINNAME@.gen.hh', capture : true, install : true, - install_dir : includedir / 'nix', + install_dir : includedir / 'lix/libexpr', ) endforeach subdir('flake') @@ -127,7 +127,7 @@ libexpr_headers = files( ) libexpr = library( - 'nixexpr', + 'lixexpr', libexpr_sources, parser_tab, lexer_tab, @@ -152,7 +152,7 @@ libexpr = library( install_headers( libexpr_headers, - subdir : 'nix', + subdir : 'lix/libexpr', preserve_path : true, ) @@ -164,8 +164,8 @@ liblixexpr = declare_dependency( # FIXME: not using the pkg-config module because it creates way too many deps # while meson migration is in progress, and we want to not include boost here configure_file( - input : 'nix-expr.pc.in', - output : 'nix-expr.pc', + input : 'lix-expr.pc.in', + output : 'lix-expr.pc', install_dir : libdir / 'pkgconfig', configuration : { 'prefix' : prefix, diff --git a/src/libexpr/nix-expr.pc.in b/src/libexpr/nix-expr.pc.in deleted file mode 100644 index 60ffb5dba..000000000 --- a/src/libexpr/nix-expr.pc.in +++ /dev/null @@ -1,10 +0,0 @@ -prefix=@prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: Nix -Description: Nix Package Manager -Version: @PACKAGE_VERSION@ -Requires: nix-store bdw-gc -Libs: -L${libdir} -lnixexpr -Cflags: -I${includedir}/nix -std=c++2a diff --git a/src/libfetchers/lix-fetchers.pc.in b/src/libfetchers/lix-fetchers.pc.in new file mode 100644 index 000000000..fa213b769 --- /dev/null +++ b/src/libfetchers/lix-fetchers.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: Lix libfetchers +Description: Lix Package Manager (libfetchers) +Version: @PACKAGE_VERSION@ +Requires: lix-base lix-util +Libs: -L${libdir} -llixfetchers +Cflags: -I${includedir}/lix/libfetchers diff --git a/src/libfetchers/meson.build b/src/libfetchers/meson.build index 3809701b7..dbb85b84c 100644 --- a/src/libfetchers/meson.build +++ b/src/libfetchers/meson.build @@ -23,7 +23,7 @@ libfetchers_headers = files( ) libfetchers = library( - 'nixfetchers', + 'lixfetchers', libfetchers_sources, dependencies : [ liblixstore, @@ -35,7 +35,21 @@ libfetchers = library( install_rpath : libdir, ) -install_headers(libfetchers_headers, subdir : 'nix', preserve_path : true) +install_headers(libfetchers_headers, subdir : 'lix/libfetchers', preserve_path : true) + +# FIXME: not using the pkg-config module because it creates way too many deps +# while meson migration is in progress, and we want to not include boost here +configure_file( + input : 'lix-fetchers.pc.in', + output : 'lix-fetchers.pc', + install_dir : libdir / 'pkgconfig', + configuration : { + 'prefix' : prefix, + 'libdir' : libdir, + 'includedir' : includedir, + 'PACKAGE_VERSION' : meson.project_version(), + }, +) liblixfetchers = declare_dependency( include_directories : include_directories('.'), diff --git a/src/libmain/lix-main.pc.in b/src/libmain/lix-main.pc.in new file mode 100644 index 000000000..0ceaec393 --- /dev/null +++ b/src/libmain/lix-main.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: Lix libmain +Description: Lix Package Manager (libmain) +Version: @PACKAGE_VERSION@ +Requires: lix-base lix-util +Libs: -L${libdir} -llixmain +Cflags: -I${includedir}/lix/libmain diff --git a/src/libmain/meson.build b/src/libmain/meson.build index 3f50b158d..b17247a9d 100644 --- a/src/libmain/meson.build +++ b/src/libmain/meson.build @@ -14,7 +14,7 @@ libmain_headers = files( ) libmain = library( - 'nixmain', + 'lixmain', libmain_sources, dependencies : [ liblixutil, @@ -25,7 +25,7 @@ libmain = library( install_rpath : libdir, ) -install_headers(libmain_headers, subdir : 'nix', preserve_path : true) +install_headers(libmain_headers, subdir : 'lix/libmain', preserve_path : true) liblixmain = declare_dependency( include_directories : include_directories('.'), @@ -35,8 +35,8 @@ liblixmain = declare_dependency( # FIXME: not using the pkg-config module because it creates way too many deps # while meson migration is in progress, and we want to not include boost here configure_file( - input : 'nix-main.pc.in', - output : 'nix-main.pc', + input : 'lix-main.pc.in', + output : 'lix-main.pc', install_dir : libdir / 'pkgconfig', configuration : { 'prefix' : prefix, diff --git a/src/libmain/nix-main.pc.in b/src/libmain/nix-main.pc.in deleted file mode 100644 index fb3ead6fa..000000000 --- a/src/libmain/nix-main.pc.in +++ /dev/null @@ -1,9 +0,0 @@ -prefix=@prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: Nix -Description: Nix Package Manager -Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -lnixmain -Cflags: -I${includedir}/nix -std=c++2a diff --git a/src/libstore/lix-store.pc.in b/src/libstore/lix-store.pc.in new file mode 100644 index 000000000..69c323a28 --- /dev/null +++ b/src/libstore/lix-store.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: Lix libstore +Description: Lix Package Manager (libstore) +Version: @PACKAGE_VERSION@ +Requires: lix-base lix-util +Libs: -L${libdir} -llixstore -llixutil +Cflags: -I${includedir}/lix/libstore diff --git a/src/libstore/meson.build b/src/libstore/meson.build index 5fde92dd0..4ccb03df7 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -6,7 +6,7 @@ foreach header : [ 'schema.sql', 'ca-specific-schema.sql' ] output : '@PLAINNAME@.gen.hh', capture : true, install : true, - install_dir : includedir / 'nix', + install_dir : includedir / 'lix/libstore', ) endforeach @@ -201,7 +201,7 @@ foreach name, value : cpp_str_defines endforeach libstore = library( - 'nixstore', + 'lixstore', libstore_generated_headers, libstore_sources, dependencies : [ @@ -224,7 +224,7 @@ libstore = library( install_rpath : libdir, ) -install_headers(libstore_headers, subdir : 'nix', preserve_path : true) +install_headers(libstore_headers, subdir : 'lix/libstore', preserve_path : true) # Used by libfetchers. liblixstore = declare_dependency( @@ -235,8 +235,8 @@ liblixstore = declare_dependency( # FIXME: not using the pkg-config module because it creates way too many deps # while meson migration is in progress, and we want to not include boost here configure_file( - input : 'nix-store.pc.in', - output : 'nix-store.pc', + input : 'lix-store.pc.in', + output : 'lix-store.pc', install_dir : libdir / 'pkgconfig', configuration : { 'prefix' : prefix, diff --git a/src/libstore/nix-store.pc.in b/src/libstore/nix-store.pc.in deleted file mode 100644 index dc42d0bca..000000000 --- a/src/libstore/nix-store.pc.in +++ /dev/null @@ -1,9 +0,0 @@ -prefix=@prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: Nix -Description: Nix Package Manager -Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -lnixstore -lnixutil -Cflags: -I${includedir}/nix -std=c++2a diff --git a/src/libutil/lix-util.pc.in b/src/libutil/lix-util.pc.in new file mode 100644 index 000000000..cd749aabb --- /dev/null +++ b/src/libutil/lix-util.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: Lix libutil +Description: Lix Package Manager (libutil) +Version: @PACKAGE_VERSION@ +Requires: lix-base lix-util +Libs: -L${libdir} -llixutil +Cflags: -I${includedir}/lix/libutil diff --git a/src/libutil/meson.build b/src/libutil/meson.build index 13266f6bd..58e0bd062 100644 --- a/src/libutil/meson.build +++ b/src/libutil/meson.build @@ -100,7 +100,7 @@ libutil_headers = files( ) libutil = library( - 'nixutil', + 'lixutil', libutil_sources, dependencies : [ aws_sdk, @@ -118,7 +118,21 @@ libutil = library( install : true, ) -install_headers(libutil_headers, subdir : 'nix', preserve_path : true) +install_headers(libutil_headers, subdir : 'lix/libutil', preserve_path : true) + +# FIXME: not using the pkg-config module because it creates way too many deps +# while meson migration is in progress, and we want to not include boost here +configure_file( + input : 'lix-util.pc.in', + output : 'lix-util.pc', + install_dir : libdir / 'pkgconfig', + configuration : { + 'prefix' : prefix, + 'libdir' : libdir, + 'includedir' : includedir, + 'PACKAGE_VERSION' : meson.project_version(), + }, +) # Used by libstore and libfetchers. liblixutil = declare_dependency( diff --git a/src/lix-base.pc.in b/src/lix-base.pc.in new file mode 100644 index 000000000..925a7753a --- /dev/null +++ b/src/lix-base.pc.in @@ -0,0 +1,8 @@ +prefix=@prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: Lix base +Description: Lix Package Manager (config.hh fixup) +Version: @PACKAGE_VERSION@ +Cflags: -I${includedir}/lix diff --git a/tests/unit/meson.build b/tests/unit/meson.build index f5355cce8..a997a0d56 100644 --- a/tests/unit/meson.build +++ b/tests/unit/meson.build @@ -17,7 +17,7 @@ libutil_test_support_sources = files( 'libutil-support/tests/terminal-code-eater.cc', ) libutil_test_support = library( - 'nixutil-test-support', + 'lixutil-test-support', libutil_test_support_sources, dependencies : [ liblixutil, @@ -57,7 +57,7 @@ libutil_tests_sources = files( ) libutil_tester = executable( - 'libnixutil-tests', + 'liblixutil-tests', libutil_tests_sources, dependencies : [ rapidcheck, @@ -90,7 +90,7 @@ libstore_test_support_sources = files( ) libstore_test_support = library( - 'nixstore-test-support', + 'lixstore-test-support', libstore_test_support_sources, dependencies : [ liblixutil_test_support, @@ -124,7 +124,7 @@ libstore_tests_sources = files( ) libstore_tester = executable( - 'libnixstore-tests', + 'liblixstore-tests', libstore_tests_sources, dependencies : [ liblixstore_test_support, @@ -154,7 +154,7 @@ libexpr_test_support_sources = files( ) libexpr_test_support = library( - 'nixexpr-test-support', + 'lixexpr-test-support', libexpr_test_support_sources, dependencies : [ liblixstore_test_support, @@ -185,7 +185,7 @@ libexpr_tests_sources = files( ) libexpr_tester = executable( - 'libnixexpr-tests', + 'liblixexpr-tests', libexpr_tests_sources, dependencies : [ liblixexpr_test_support, |