This is useful to build a Wine-based toolchain, third-party external modules can then build and link unixlibs against ntdll.so (and win32u.so), without requiring a full Wine build.
-- v2: makedep: Install unixlibs with install-dev as well.
From: Rémi Bernon rbernon@codeweavers.com
--- tools/makedep.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/tools/makedep.c b/tools/makedep.c index 4e73894c933..893adbbaaac 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -120,9 +120,9 @@ static const struct static struct list files[HASH_SIZE]; static struct list global_includes[HASH_SIZE];
-enum install_rules { INSTALL_LIB, INSTALL_DEV, INSTALL_TEST, NB_INSTALL_RULES }; -static const char *install_targets[NB_INSTALL_RULES] = { "install-lib", "install-dev", "install-test" }; -static const char *install_variables[NB_INSTALL_RULES] = { "INSTALL_LIB", "INSTALL_DEV", "INSTALL_TEST" }; +enum install_rules { INSTALL_LIB, INSTALL_DEV, INSTALL_UNIX, INSTALL_TEST, NB_INSTALL_RULES }; +static const char *install_targets[NB_INSTALL_RULES] = { "install-lib", "install-dev", "install-unix", "install-test" }; +static const char *install_variables[NB_INSTALL_RULES] = { "INSTALL_LIB", "INSTALL_DEV", "INSTALL_UNIX", "INSTALL_TEST" };
#define MAX_ARCHS 6
@@ -2729,6 +2729,7 @@ static void output_install_rules( struct makefile *make ) strarray_addall_uniq( &targets, cmd->targets );
if (strcmp( install_targets[i], "install-test" )) output( "install " ); + if (!strcmp( install_targets[i], "install-unix" )) output( "install-lib install-dev " ); output( "%s::", install_targets[i] ); output_filenames( targets ); output_filename( install ); @@ -3710,6 +3711,7 @@ static void output_unix_lib( struct makefile *make )
strarray_add( &make->all_targets[arch], make->unixlib ); install_program( make, make->module, arch, make->unixlib, arch_install_dirs[arch] ); + install_program( make, make->unixlib, arch, make->unixlib, arch_install_dirs[arch] ); output( "%s:", obj_dir_path( make, make->unixlib )); output_filenames_obj_dir( make, make->unixobj_files ); output_filenames( unix_deps ); @@ -4567,6 +4569,7 @@ static void load_sources( struct makefile *make ) for (i = 0; i < NB_INSTALL_RULES; i++) if (make->install[i].count) break; if (i == NB_INSTALL_RULES && !make->extlib) { + if (make->unixlib) strarray_add( &make->install[INSTALL_UNIX], make->unixlib ); if (make->importlib) strarray_add( &make->install[INSTALL_DEV], make->importlib ); if (make->staticlib) strarray_add( &make->install[INSTALL_DEV], make->staticlib ); else strarray_add( &make->install[INSTALL_LIB], make->module );
v2: Install all unixlibs with a new install-unix rule, shared by install-lib and install-dev instead. It has a slightly larger scope than necessary but it should hopefully be alright. Otherwise we can also probably make INSTALL_UNIX opt-in for `ntdll` and `win32u`.
I don't think we want two targets to install the same files.
The usual way on Linux is that the -lib package includes a .so.1, and the -dev package includes a .so symlink. This implies that you need the -lib package to build things. I think it's fine for Wine to do the same.
The issue is that install-lib requires building everything, which is a fairly long process, while install-dev only requires building headers and import libs, which can be done quickly (relatively speaking). It is quite convenient for the purpose of building a Wine-based toolchain. And if we want the toolchain to be useful, now that wine/unixlib.h is installed, ntdll.so needs to be available too for linking.
In Proton we used that to build third-party modules in parallel to Wine, which makes rebuilding much faster as they don't need to wait for a full Wine rebuild and install. It was possible before with the `dlls/ntdll/install-lib` `dlls/win32u/install-lib` targets, but they are gone now and there's no alternative to install only these two unixlibs.