forked from mesonbuild/meson
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix regression when using both libraries
This partly reverts mesonbuild#12632 and provide an alternative implementation. The issue is we cannot propagate BothLibraries objects beyond the interpreter because it breaks many isinstance(obj, SharedLibrary) cases. Instead make SharedLibrary and StaticLibrary cross reference each other so we can take their brother library in as_static() and as_shared() methods.
- Loading branch information
Showing
11 changed files
with
87 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include "bar.h" | ||
#include "foo.h" | ||
|
||
int bar_func(void) | ||
{ | ||
return foo_func() + 42; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
int bar_func(void); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "foo.h" | ||
|
||
int foo_func(void) | ||
{ | ||
return 42; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
int foo_func(void); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
project('gir both libraries', 'c') | ||
|
||
gir = dependency('gobject-introspection-1.0', required: false) | ||
if not gir.found() | ||
error('MESON_SKIP_TEST gobject-introspection not found.') | ||
endif | ||
|
||
gnome = import('gnome') | ||
|
||
# Regression test simulating how GStreamer generate its GIRs. | ||
# Generated gobject-introspection binaries for every GStreamer libraries must | ||
# first call gst_init() defined in the main libgstreamer, which means they need | ||
# to link on that lib. | ||
# A regression caused by https://github.com/mesonbuild/meson/pull/12632 made | ||
# Meson not link the binary generated for bar with libfoo in the case it uses | ||
# both_libraries(). | ||
|
||
libfoo = both_libraries('foo', 'foo.c') | ||
foo_gir = gnome.generate_gir(libfoo, | ||
namespace: 'foo', | ||
nsversion: '1.0', | ||
sources: ['foo.c', 'foo.h'], | ||
) | ||
foo_dep = declare_dependency( | ||
link_with: libfoo, | ||
#link_with: libfoo.get_shared_lib(), | ||
sources: foo_gir, | ||
) | ||
|
||
libbar = both_libraries('bar', 'bar.c', dependencies: foo_dep) | ||
gnome.generate_gir(libbar, | ||
namespace: 'bar', | ||
nsversion: '1.0', | ||
sources: ['bar.c', 'bar.h'], | ||
extra_args: '--add-init-section=extern void foo_func(void);foo_func();', | ||
dependencies: foo_dep, | ||
) |