This is an automated email from the git hooks/post-receive script.
firstyear pushed a commit to branch master
in repository 389-ds-base.
commit 26f78c1b3992684982845a4d483368e73bc90743
Author: William Brown <firstyear(a)redhat.com>
Date: Tue Nov 21 11:23:05 2017 +0100
Ticket 49325 - fix rust linking.
Bug Description: An issue with the rpm was found that the way
the static .a was built would cause a missing library error when
the rpm was distributed.
Fix Description: Because both cargo and automake are opinionated
and stubborn, this leaves the option as have cargo generate the .so
but write manual rules for install and linking. This has been tested
now with non-prefix, prefix, rpm build, copr.
https://pagure.io/389-ds-base/issue/49325
Author: wibrown
Review by: mreynolds (Thanks!)
---
Makefile.am | 39 ++++++++++++++++++++++-----------------
rpm/389-ds-base.spec.in | 5 +----
src/libsds/Cargo.toml | 2 +-
3 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 8df31e5..3ac5584 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -314,11 +314,7 @@ bin_PROGRAMS = dbscan \
# based on defines
#
----------------------------------------------------------------------------------------
-server_LTLIBRARIES =
-if RUST_ENABLE
-server_LTLIBRARIES += librsds.la
-endif
-server_LTLIBRARIES += libsds.la libnunc-stans.la libldaputil.la libslapd.la
libns-dshttpd.la
+server_LTLIBRARIES = libsds.la libnunc-stans.la libldaputil.la libslapd.la
libns-dshttpd.la
# this is how to add optional plugins
@@ -1101,25 +1097,34 @@ libsds_la_CPPFLAGS = $(AM_CPPFLAGS) $(SDS_CPPFLAGS)
libsds_la_LDFLAGS = $(AM_LDFLAGS) $(SDS_LDFLAGS)
if RUST_ENABLE
-libsds_la_LIBADD = librsds.la
-
-librsdspatha = $(abs_top_builddir)/rs/@rust_target_dir(a)/librsds.a
-librsdspatho = $(abs_top_builddir)/rs/@rust_target_dir(a)/librsds.o
-# Remember, these emit to cargo_target_dir/<at>rust_target_dir<at>/emit
target
-$(librsdspatha): Makefile src/libsds/Cargo.toml src/libsds/sds/lib.rs
src/libsds/sds/tqueue.rs
- CARGO_TARGET_DIR=$(abs_top_builddir)/rs cargo rustc $(CARGO_FLAGS) --verbose
--manifest-path=$(srcdir)/src/libsds/Cargo.toml -- $(RUSTC_FLAGS) --emit
link=$(librsdspatha)
+### Why does this exist?
+#
+# Both cargo and autotools are really opinionated. You can't generate the correct
+# outputs from cargo/rust for automake to use. But by the same token, you can't
+# convince automake to use the outputs we *do* have. So instead, we manually
+# create and install the .so instead.
+#
+# This acts like .PHONY for some reason ...
-$(librsdspatho): Makefile src/libsds/Cargo.toml src/libsds/sds/lib.rs
src/libsds/sds/tqueue.rs
- CARGO_TARGET_DIR=$(abs_top_builddir)/rs cargo rustc $(CARGO_FLAGS) --verbose
--manifest-path=$(srcdir)/src/libsds/Cargo.toml -- $(RUSTC_FLAGS) --emit
obj=$(librsdspatho)
+libsds_la_LDFLAGS += -L$(abs_builddir)/.libs -lrsds
+libsds_la_DEPENDENCIES = librsds.so
-am_librsds_la_OBJECTS = $(librsdspatho)
-librsds_la_LIBADD = $(librsdspatha)
-librsds_la_SOURCES =
+librsds.so: src/libsds/Cargo.toml src/libsds/sds/lib.rs src/libsds/sds/tqueue.rs
+ CARGO_TARGET_DIR=$(abs_top_builddir)/rs \
+ cargo rustc $(CARGO_FLAGS) --verbose --manifest-path=$(srcdir)/src/libsds/Cargo.toml \
+ -- $(RUSTC_FLAGS)
+ mkdir -p $(abs_builddir)/.libs
+ cp $(abs_top_builddir)/rs/@rust_target_dir(a)/librsds.so $(abs_builddir)/.libs/librsds.so
dist_noinst_DATA += $(srcdir)/src/libsds/Cargo.toml \
$(srcdir)/src/libsds/sds/*.rs
+# echo $(serverdir)
+install-data-local:
+ $(MKDIR_P) $(DESTDIR)$(serverdir)
+ $(INSTALL) -c -m 755 $(abs_builddir)/.libs/librsds.so $(DESTDIR)$(serverdir)/librsds.so
+
else
# Just build the tqueue in C.
libsds_la_SOURCES += \
diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in
index c79d4d0..19c4f14 100644
--- a/rpm/389-ds-base.spec.in
+++ b/rpm/389-ds-base.spec.in
@@ -560,9 +560,6 @@ fi
%{_libdir}/%{pkgname}/libnunc-stans.so
%{_libdir}/%{pkgname}/libsds.so
%{_libdir}/%{pkgname}/libldaputil.so
-%if %{use_rust}
-%{_libdir}/%{pkgname}/librsds.so
-%endif
%{_libdir}/pkgconfig/*
%files libs
@@ -575,7 +572,7 @@ fi
%{_libdir}/%{pkgname}/libsds.so.*
%{_libdir}/%{pkgname}/libldaputil.so.*
%if %{use_rust}
-%{_libdir}/%{pkgname}/librsds.so.*
+%{_libdir}/%{pkgname}/librsds.so
%endif
%files snmp
diff --git a/src/libsds/Cargo.toml b/src/libsds/Cargo.toml
index 594326c..2c57e66 100644
--- a/src/libsds/Cargo.toml
+++ b/src/libsds/Cargo.toml
@@ -8,7 +8,7 @@ authors = ["William Brown <firstyear(a)redhat.com>"]
[lib]
path = "sds/lib.rs"
name = "rsds"
-crate-type = ["dylib"]
+crate-type = ["cdylib"]
[profile.release]
panic = "abort"
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.