Alexandre Julliard : makefiles: Link with the full library name for Unix library imports.
Alexandre Julliard
julliard at winehq.org
Mon Sep 20 16:26:19 CDT 2021
Module: wine
Branch: master
Commit: eda25a58c5e886bde89cce6b05c299646a0a667e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=eda25a58c5e886bde89cce6b05c299646a0a667e
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Sep 20 15:30:27 2021 +0200
makefiles: Link with the full library name for Unix library imports.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
tools/makedep.c | 39 ++++++++++++++++++++++++---------------
1 file changed, 24 insertions(+), 15 deletions(-)
diff --git a/tools/makedep.c b/tools/makedep.c
index acc3dc67e25..7a3b55421aa 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -2111,6 +2111,18 @@ static const char *get_static_lib( const struct makefile *make, const char *name
}
+/*******************************************************************
+ * get_native_unix_lib
+ */
+static const char *get_native_unix_lib( const struct makefile *make, const char *name )
+{
+ if (!make->unixlib) return NULL;
+ if (strncmp( make->unixlib, name, strlen(name) )) return NULL;
+ if (make->unixlib[strlen(name)] != '.') return NULL;
+ return obj_dir_path( make, make->unixlib );
+}
+
+
/*******************************************************************
* get_parent_makefile
*/
@@ -2162,13 +2174,15 @@ static int needs_implib_symlink( const struct makefile *make )
/*******************************************************************
* add_unix_libraries
*/
-static struct strarray add_unix_libraries( const struct makefile *make, struct strarray *deps )
+static struct strarray add_unix_libraries( const struct makefile *make, struct strarray *deps,
+ int native_unix )
{
struct strarray ret = empty_strarray;
struct strarray all_libs = empty_strarray;
unsigned int i, j;
strarray_add( &all_libs, "-lwine_port" );
+ if (native_unix && strcmp( make->module, "ntdll.dll" )) strarray_add( &all_libs, "-lntdll" );
strarray_addall( &all_libs, get_expanded_make_var_array( make, "EXTRALIBS" ));
strarray_addall( &all_libs, libs );
@@ -2182,6 +2196,9 @@ static struct strarray add_unix_libraries( const struct makefile *make, struct s
for (j = 0; j < subdirs.count; j++)
if ((lib = get_static_lib( submakes[j], name ))) break;
+ if (!lib && native_unix)
+ for (j = 0; j < subdirs.count; j++)
+ if ((lib = get_native_unix_lib( submakes[j], name ))) break;
}
if (lib)
@@ -3325,7 +3342,7 @@ static void output_module( struct makefile *make )
}
else if (*dll_ext)
{
- if (!make->use_msvcrt) strarray_addall( &all_libs, add_unix_libraries( make, &dep_libs ));
+ if (!make->use_msvcrt) strarray_addall( &all_libs, add_unix_libraries( make, &dep_libs, 0 ));
for (i = 0; i < make->delayimports.count; i++)
strarray_add( &all_libs, strmake( "-Wl,-delayload,%s%s", make->delayimports.str[i],
strchr( make->delayimports.str[i], '.' ) ? "" : ".dll" ));
@@ -3339,7 +3356,7 @@ static void output_module( struct makefile *make )
}
else
{
- strarray_addall( &all_libs, add_unix_libraries( make, &dep_libs ));
+ strarray_addall( &all_libs, add_unix_libraries( make, &dep_libs, 0 ));
strarray_add( &make->all_targets, make->module );
add_install_rule( make, make->module, make->module,
strmake( "p$(%s)/%s", spec_file ? "dlldir" : "bindir", make->module ));
@@ -3376,15 +3393,7 @@ static void output_module( struct makefile *make )
struct strarray extra_libs = get_expanded_make_var_array( make, "EXTRALIBS" );
int native_unix_lib = strarray_exists( &extra_libs, "-Wl,--subsystem,unixlib" );
- if (native_unix_lib)
- {
- if (strcmp( make->module, "ntdll.dll" ))
- {
- strarray_add( &unix_libs, "-lntdll" );
- strarray_add( &unix_deps, obj_dir_path( top_makefile, "dlls/ntdll/ntdll.so" ));
- }
- }
- else
+ if (!native_unix_lib)
{
struct strarray unix_imports = empty_strarray;
@@ -3399,7 +3408,7 @@ static void output_module( struct makefile *make )
strarray_addall( &unix_libs, add_import_libs( make, &unix_deps, unix_imports, 0, 1 ));
}
- strarray_addall( &unix_libs, add_unix_libraries( make, &unix_deps ));
+ strarray_addall( &unix_libs, add_unix_libraries( make, &unix_deps, native_unix_lib ));
strarray_add( &make->all_targets, make->unixlib );
add_install_rule( make, make->module, make->unixlib, strmake( "p%s/%s", so_dir, make->unixlib ));
@@ -3546,7 +3555,7 @@ static void output_shared_lib( struct makefile *make )
strarray_addall( &dep_libs, get_local_dependencies( make, basename, make->in_files ));
strarray_addall( &all_libs, get_expanded_file_local_var( make, basename, "LDFLAGS" ));
- strarray_addall( &all_libs, add_unix_libraries( make, &dep_libs ));
+ strarray_addall( &all_libs, add_unix_libraries( make, &dep_libs, 0 ));
output( "%s:", obj_dir_path( make, make->sharedlib ));
output_filenames_obj_dir( make, make->object_files );
@@ -3660,7 +3669,7 @@ static void output_programs( struct makefile *make )
if (!objs.count) objs = make->object_files;
if (!strarray_exists( &all_libs, "-nodefaultlibs" ))
- strarray_addall( &all_libs, add_unix_libraries( make, &deps ));
+ strarray_addall( &all_libs, add_unix_libraries( make, &deps, 0 ));
output( "%s:", obj_dir_path( make, program ) );
output_filenames_obj_dir( make, objs );
More information about the wine-cvs
mailing list