Skip to content

Commit 8cea2b3

Browse files
committed
Add a dummy file, to make sure the library is non-empty
Should fix the macOS build.
1 parent ad86ab8 commit 8cea2b3

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

Makefile.am

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ noinst_LTLIBRARIES = librsvg_c_api.la
88
# This is empty, because automake wants to have a C sources list for
99
# the LTLIBRARIES. See LIBRSVG_INTERNALS_SRC below for the real list
1010
# of Rust sources.
11-
librsvg_c_api_la_SOURCES =
11+
librsvg_c_api_la_SOURCES = librsvg/dummy.c
1212

1313
bin_PROGRAMS = rsvg-convert
1414

@@ -182,7 +182,7 @@ dist-hook:
182182
mkdir .cargo && \
183183
cp cargo-vendor-config .cargo/config)
184184

185-
librsvg_c_api.la: $(LIBRSVG_INTERNALS_SRC) $(LIBRSVG_C_API_SRC)
185+
librsvg_c_api.la: $(librsvg_c_api_la_OBJECTS) $(LIBRSVG_INTERNALS_SRC) $(LIBRSVG_C_API_SRC)
186186
+cd $(top_srcdir)/librsvg && \
187187
PKG_CONFIG_ALLOW_CROSS=1 \
188188
PKG_CONFIG='$(PKG_CONFIG)' \
@@ -191,7 +191,7 @@ librsvg_c_api.la: $(LIBRSVG_INTERNALS_SRC) $(LIBRSVG_C_API_SRC)
191191
&& if [[ $$($(NM) -g $(RUST_LIB) | grep "T __*clzsi2" -c) -gt 1 ]] ; then \
192192
$(AR) d $(RUST_LIB) clzsi2.o; \
193193
fi \
194-
&& cd $(LIBRSVG_BUILD_DIR) && $(LINK) && mv $(RUST_LIB) .libs/librsvg_c_api.a
194+
&& cd $(LIBRSVG_BUILD_DIR) && $(LINK) $< && mv $(RUST_LIB) .libs/librsvg_c_api.a
195195

196196
librsvg_@RSVG_API_MAJOR_VERSION@_la_CPPFLAGS = \
197197
-I$(top_srcdir) \

librsvg/dummy.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* A dummy file, to prevent empty libraries from breaking builds.
2+
3+
This file is in the public domain. -- Bruno Haible */
4+
5+
/* Some systems, reportedly OpenBSD and Mac OS X, refuse to create
6+
libraries without any object files. You might get an error like:
7+
8+
> ar cru .libs/libgl.a
9+
> ar: no archive members specified
10+
11+
Compiling this file, and adding its object file to the library, will
12+
prevent the library from being empty. */
13+
14+
/* Some systems, such as Solaris with cc 5.0, refuse to work with libraries
15+
that don't export any symbol. You might get an error like:
16+
17+
> cc ... libgnu.a
18+
> ild: (bad file) garbled symbol table in archive ../gllib/libgnu.a
19+
20+
Compiling this file, and adding its object file to the library, will
21+
prevent the library from exporting no symbols. */
22+
23+
#ifdef __sun
24+
/* This declaration ensures that the library will export at least 1 symbol. */
25+
int gl_dummy_symbol;
26+
#else
27+
/* This declaration is solely to ensure that after preprocessing
28+
this file is never empty. */
29+
typedef int dummy;
30+
#endif

0 commit comments

Comments
 (0)