Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cxx-rs for core.rs #2336

Merged
merged 5 commits into from
Dec 23, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cci.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ parallel rpms: {
shwrap("""
# fetch tags so `git describe` gives a nice NEVRA when building the RPM
git fetch origin --tags
ci/install-extra-builddeps.sh
ci/installdeps.sh
git submodule update --init

Expand Down
31 changes: 19 additions & 12 deletions Makefile-rpm-ostree.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@

bin_PROGRAMS += rpm-ostree

rpm_ostree_SOURCES = src/app/main.cxx \
rpm_ostree_SOURCES = src/app/main.cxx

noinst_LTLIBRARIES += librpmostreeinternals.la

librpmostreeinternals_la_SOURCES = \
src/app/libmain.cxx \
src/app/rpmostree-builtins.h \
src/app/rpmostree-db-builtins.h \
src/app/rpmostree-compose-builtins.h \
Expand Down Expand Up @@ -65,25 +70,30 @@ rpm_ostree_SOURCES = src/app/main.cxx \
$(NULL)

if BUILDOPT_ROJIG
rpm_ostree_SOURCES += \
librpmostreeinternals_la_SOURCES += \
src/app/rpmostree-ex-builtin-commit2rojig.cxx \
src/app/rpmostree-ex-builtin-rojig2commit.cxx \
src/app/rpmostree-compose-builtin-rojig.cxx \
$(NULL)
endif

nodist_rpm_ostree_SOURCES = $(dbus_built_sources) $(nodist_librpmostreepriv_sources)
nodist_librpmostreeinternals_la_SOURCES = $(dbus_built_sources) $(nodist_librpmostreepriv_sources)

rpmostree_common_cflags = -I$(srcdir)/src/app -I$(srcdir)/src/daemon \
-I$(srcdir)/src/lib -I$(srcdir)/src/libpriv -I$(libglnx_srcpath) \
-fvisibility=hidden \
-DG_LOG_DOMAIN=\"rpm-ostreed\" \
-DLIBDIR=\"$(libdir)\" -DPKGLIBDIR=\"$(pkglibdir)\" \
$(PKGDEP_RPMOSTREE_CFLAGS)
rpm_ostree_CFLAGS = $(AM_CFLAGS) $(rpmostree_common_cflags)
rpm_ostree_CXXFLAGS = $(AM_CXXFLAGS) $(rpmostree_common_cflags)
rpm_ostree_LDADD = $(PKGDEP_RPMOSTREE_LIBS) $(CAP_LIBS) libglnx.la librpmostree-1.la
$(PKGDEP_RPMOSTREE_CFLAGS) $(PKGDEP_RPMOSTREE_RS_CFLAGS)
rpmostree_bin_common_cflags = $(rpmostree_common_cflags)
rpmostree_bin_common_libs = $(PKGDEP_RPMOSTREE_LIBS) $(CAP_LIBS) libglnx.la librpmostree-1.la $(librpmostree_rust_path) $(PKGDEP_RPMOSTREE_RS_LIBS) -lstdc++
rpm_ostree_CFLAGS = $(AM_CFLAGS) $(rpmostree_bin_common_cflags)
rpm_ostree_CXXFLAGS = $(AM_CXXFLAGS) $(rpmostree_bin_common_cflags)
rpm_ostree_LDADD = librpmostreeinternals.la $(rpmostree_bin_common_libs)
EXTRA_rpm_ostree_DEPENDENCIES = libdnf.so.2
librpmostreeinternals_la_CFLAGS = $(AM_CFLAGS) $(rpmostree_common_cflags)
librpmostreeinternals_la_CXXFLAGS = $(AM_CXXFLAGS) $(rpmostree_common_cflags)
librpmostreeinternals_la_LIBADD = $(rpmostree_bin_common_libs)
EXTRA_librpmostreeinternals_la_DEPENDENCIES = libdnf.so.2

privdatadir=$(pkglibdir)
privdata_DATA = src/app/rpm-ostree-0-integration.conf
Expand All @@ -107,7 +117,7 @@ endif
endif
GITIGNOREFILES += tooling/target/ rpmostree-bindgen

librpmostree_rust_path = @abs_top_builddir@/target/@RUST_TARGET_SUBDIR@/librpmostree_rust.a
librpmostree_rust_path = $(top_srcdir)/target/@RUST_TARGET_SUBDIR@/librpmostree_rust.a
# If the target directory exists, and isn't owned by our uid, then
# we exit with a fatal error, since someone probably did `make && sudo make install`,
# and in this case cargo will download into ~/.root which we don't want.
Expand All @@ -133,9 +143,6 @@ endif
endif
BUILT_SOURCES += rpmostree-rust.h

rpm_ostree_CFLAGS += $(PKGDEP_RPMOSTREE_RS_CFLAGS)
rpm_ostree_LDADD += $(librpmostree_rust_path) $(PKGDEP_RPMOSTREE_RS_LIBS) -lstdc++

# Wraps `cargo test`. This is always a debug non-release build;
# the main thing here is we still drop the `target` dir in our build
# directory, since we nominally support srcdir != builddir.
Expand Down
65 changes: 32 additions & 33 deletions Makefile-tests.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,38 @@ endif

GITIGNOREFILES += ssh-config ansible-inventory.yml vmcheck-logs/ test-compose-logs/ tests/vmcheck/image.qcow2

# Disabled for now because we dropped librpmostreepriv.la
# testbin_cppflags = $(AM_CPPFLAGS) -I $(srcdir)/src/lib -I $(srcdir)/src/libpriv -I $(srcdir)/libglnx -I $(srcdir)/tests/common
# testbin_cflags = $(AM_CFLAGS) -fvisibility=hidden $(PKGDEP_RPMOSTREE_CFLAGS)
# testbin_ldadd = $(PKGDEP_RPMOSTREE_LIBS) librpmostree-1.la librpmostreepriv.la -lstdc++
#
# noinst_LTLIBRARIES += libtest.la
# libtest_la_SOURCES = tests/common/libtest.c
# libtest_la_CPPFLAGS = $(testbin_cppflags)
# libtest_la_CFLAGS = $(testbin_cflags)
# libtest_la_LIBADD = $(testbin_ldadd)
#
# tests_check_jsonutil_CPPFLAGS = $(testbin_cppflags)
# tests_check_jsonutil_CFLAGS = $(testbin_cflags)
# tests_check_jsonutil_LDADD = $(testbin_ldadd) libtest.la
#
# tests_check_postprocess_CPPFLAGS = $(testbin_cppflags)
# tests_check_postprocess_CFLAGS = $(testbin_cflags)
# tests_check_postprocess_LDADD = $(testbin_ldadd) libtest.la
#
# tests_check_test_utils_CPPFLAGS = $(testbin_cppflags)
# tests_check_test_utils_CFLAGS = $(testbin_cflags)
# tests_check_test_utils_LDADD = $(testbin_ldadd) libtest.la
#
# tests_check_test_sysusers_CPPFLAGS = $(testbin_cppflags)
# tests_check_test_sysusers_CFLAGS = $(testbin_cflags)
# tests_check_test_sysusers_LDADD = $(testbin_ldadd) libtest.la
#
# uninstalled_test_programs = \
# tests/check/jsonutil \
# tests/check/postprocess \
# tests/check/test-utils \
# tests/check/test-sysusers \
# $(NULL)
testbin_cppflags = $(AM_CPPFLAGS) -I $(srcdir)/src/lib -I $(srcdir)/src/libpriv -I $(srcdir)/libglnx -I $(srcdir)/tests/common
testbin_cflags = $(AM_CFLAGS) $(rpmostree_bin_common_cflags)
testbin_ldadd = librpmostreeinternals.la $(rpmostree_bin_common_libs)

noinst_LTLIBRARIES += libtest.la
libtest_la_SOURCES = tests/common/libtest.c
libtest_la_CPPFLAGS = $(testbin_cppflags)
libtest_la_CFLAGS = $(testbin_cflags)
libtest_la_LIBADD = $(testbin_ldadd)

tests_check_jsonutil_CPPFLAGS = $(testbin_cppflags)
tests_check_jsonutil_CFLAGS = $(testbin_cflags)
tests_check_jsonutil_LDADD = $(testbin_ldadd) libtest.la

tests_check_postprocess_CPPFLAGS = $(testbin_cppflags)
tests_check_postprocess_CFLAGS = $(testbin_cflags)
tests_check_postprocess_LDADD = $(testbin_ldadd) libtest.la

tests_check_test_utils_CPPFLAGS = $(testbin_cppflags)
tests_check_test_utils_CFLAGS = $(testbin_cflags)
tests_check_test_utils_LDADD = $(testbin_ldadd) libtest.la

tests_check_test_sysusers_CPPFLAGS = $(testbin_cppflags)
tests_check_test_sysusers_CFLAGS = $(testbin_cflags)
tests_check_test_sysusers_LDADD = $(testbin_ldadd) libtest.la

uninstalled_test_programs = \
tests/check/jsonutil \
tests/check/postprocess \
tests/check/test-utils \
tests/check/test-sysusers \
$(NULL)

uninstalled_test_scripts = \
tests/check/test-lib-introspection.sh \
Expand Down
1 change: 1 addition & 0 deletions ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set -xeuo pipefail
dn=$(dirname $0)
. ${dn}/libbuild.sh

${dn}/install-extra-builddeps.sh
${dn}/installdeps.sh

# create an unprivileged user for testing
Expand Down
6 changes: 6 additions & 0 deletions ci/install-extra-builddeps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/bash
# Install build dependencies not in the cosa buildroot already
set -xeuo pipefail
if ! command -v cxxbridge; then
cargo install --root=/usr cxxbridge-cmd
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this actually need to be in /usr BTW? Running this script locally.

Copy link
Member Author

@cgwalters cgwalters Dec 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I guess we could dispatch on $(id -u)?

fi
Loading