[librsvg: 2/3] Add a dummy file, to make sure the library is non-empty
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 2/3] Add a dummy file, to make sure the library is non-empty
- Date: Wed, 16 Oct 2019 18:11:12 +0000 (UTC)
commit 8cea2b36244d4508d07d84440087c9c392b834ef
Author: Kleis Auke Wolthuizen <github kleisauke nl>
Date: Wed Oct 16 09:54:03 2019 +0200
Add a dummy file, to make sure the library is non-empty
Should fix the macOS build.
Makefile.am | 6 +++---
librsvg/dummy.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+), 3 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index a04828c9..b28ddd73 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -8,7 +8,7 @@ noinst_LTLIBRARIES = librsvg_c_api.la
# This is empty, because automake wants to have a C sources list for
# the LTLIBRARIES. See LIBRSVG_INTERNALS_SRC below for the real list
# of Rust sources.
-librsvg_c_api_la_SOURCES =
+librsvg_c_api_la_SOURCES = librsvg/dummy.c
bin_PROGRAMS = rsvg-convert
@@ -182,7 +182,7 @@ dist-hook:
mkdir .cargo && \
cp cargo-vendor-config .cargo/config)
-librsvg_c_api.la: $(LIBRSVG_INTERNALS_SRC) $(LIBRSVG_C_API_SRC)
+librsvg_c_api.la: $(librsvg_c_api_la_OBJECTS) $(LIBRSVG_INTERNALS_SRC) $(LIBRSVG_C_API_SRC)
+cd $(top_srcdir)/librsvg && \
PKG_CONFIG_ALLOW_CROSS=1 \
PKG_CONFIG='$(PKG_CONFIG)' \
@@ -191,7 +191,7 @@ librsvg_c_api.la: $(LIBRSVG_INTERNALS_SRC) $(LIBRSVG_C_API_SRC)
&& if [[ $$($(NM) -g $(RUST_LIB) | grep "T __*clzsi2" -c) -gt 1 ]] ; then \
$(AR) d $(RUST_LIB) clzsi2.o; \
fi \
- && cd $(LIBRSVG_BUILD_DIR) && $(LINK) && mv $(RUST_LIB) .libs/librsvg_c_api.a
+ && cd $(LIBRSVG_BUILD_DIR) && $(LINK) $< && mv $(RUST_LIB) .libs/librsvg_c_api.a
librsvg_@RSVG_API_MAJOR_VERSION@_la_CPPFLAGS = \
-I$(top_srcdir) \
diff --git a/librsvg/dummy.c b/librsvg/dummy.c
new file mode 100644
index 00000000..061a78c3
--- /dev/null
+++ b/librsvg/dummy.c
@@ -0,0 +1,30 @@
+/* A dummy file, to prevent empty libraries from breaking builds.
+
+ This file is in the public domain. -- Bruno Haible */
+
+/* Some systems, reportedly OpenBSD and Mac OS X, refuse to create
+ libraries without any object files. You might get an error like:
+
+ > ar cru .libs/libgl.a
+ > ar: no archive members specified
+
+ Compiling this file, and adding its object file to the library, will
+ prevent the library from being empty. */
+
+/* Some systems, such as Solaris with cc 5.0, refuse to work with libraries
+ that don't export any symbol. You might get an error like:
+
+ > cc ... libgnu.a
+ > ild: (bad file) garbled symbol table in archive ../gllib/libgnu.a
+
+ Compiling this file, and adding its object file to the library, will
+ prevent the library from exporting no symbols. */
+
+#ifdef __sun
+/* This declaration ensures that the library will export at least 1 symbol. */
+int gl_dummy_symbol;
+#else
+/* This declaration is solely to ensure that after preprocessing
+ this file is never empty. */
+typedef int dummy;
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]