-
Notifications
You must be signed in to change notification settings - Fork 197
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
Big buildsystem -> cargo rollup #2518
Changes from all commits
2356e0c
abac2e6
b78361c
571d9f2
6159820
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,29 +65,17 @@ AC_SUBST([RPM_OSTREE_FEATURES]) | |
|
||
PKG_PROG_PKG_CONFIG | ||
|
||
# Remember to update AM_CPPFLAGS in Makefile.am when bumping GIO req. | ||
dnl Remember to update AM_CPPFLAGS in Makefile.am when bumping GIO req. | ||
PKG_CHECK_MODULES(PKGDEP_GIO_UNIX, [gio-unix-2.0]) | ||
# librepo libsolv etc. are libdnf dependencies | ||
PKG_CHECK_MODULES(PKGDEP_RPMOSTREE, [gio-unix-2.0 >= 2.50.0 json-glib-1.0 | ||
ostree-1 >= 2020.7 | ||
libsystemd | ||
polkit-gobject-1 | ||
rpm librepo libsolv libsolvext sqlite3 gpgme modulemd-2.0 json-c libcurl openssl | ||
libarchive]) | ||
|
||
# We just keep rust-specific deps separate for better tracking | ||
# The `libcurl` one is redundant since we already require it for libostree. `openssl` | ||
# is required by libcurl anyway, but we need to link to it directly too because | ||
# curl-rust uses it. | ||
PKG_CHECK_MODULES(PKGDEP_RPMOSTREE_RS, [libcurl openssl]) | ||
dnl These are the dependencies of the public librpmostree-1.0.0 shared library | ||
PKG_CHECK_MODULES(PKGDEP_LIBRPMOSTREE, [gio-unix-2.0 >= 2.50.0 json-glib-1.0 ostree-1 >= 2020.7 rpm]) | ||
dnl And these additional ones are used by for the rpmostreeinternals C/C++ library | ||
PKG_CHECK_MODULES(PKGDEP_RPMOSTREE, [polkit-gobject-1 libarchive]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can clearly see this one with e.g.:
|
||
|
||
dnl RHEL8.1 has old libarchive | ||
AS_IF([pkg-config --atleast-version=3.3.3 libarchive], | ||
[AC_DEFINE([HAVE_LIBARCHIVE_ZSTD], 1, [Define if we have libarchive with zstd])]) | ||
|
||
dnl This is the current version in Fedora 25. | ||
AS_IF([pkg-config --atleast-version=4.14.2 rpm], [], [AC_MSG_ERROR([librpm 4.14.2 required])]) | ||
|
||
dnl We don't *actually* use this ourself, but librepo does, and libdnf gets confused | ||
dnl if librepo doesn't support it. | ||
have_zchunk=no | ||
|
@@ -163,38 +151,6 @@ AM_COND_IF([BUILDOPT_ROJIG], [ | |
AC_DEFINE([BUILDOPT_ROJIG], 1, [Define if rojig is enabled]) | ||
]) | ||
|
||
dnl And propagate the release/debug type to cmake | ||
cmake_args=-DCMAKE_BUILD_TYPE=RelWithDebugInfo | ||
if test ${debug_release} = debug; then | ||
cmake_args="-DCMAKE_BUILD_TYPE=Debug" | ||
fi | ||
if test x${have_zchunk} = xno; then | ||
cmake_args="${cmake_args} -DWITH_ZCHUNK:BOOL=0" | ||
fi | ||
export cmake_args | ||
|
||
dnl I picked /usr/libexec/rpm-ostree just because we need an | ||
dnl arbitrary path - we don't actually install there. | ||
dnl Use `WITH_GIR=0`; it's our private libdnf bundle and we don't need the bindings. | ||
dnl -fPIE for hardening | ||
(set -euo pipefail; mkdir -p libdnf-build && cd libdnf-build && | ||
set -x && | ||
export CXXFLAGS="-fPIE $CXXFLAGS" && | ||
cmake \ | ||
-DCMAKE_INSTALL_PREFIX:PATH=/usr/libexec/rpm-ostree \ | ||
-DINCLUDE_INSTALL_DIR:PATH=/usr/libexec/rpm-ostree/include \ | ||
-DLIB_INSTALL_DIR:PATH=/usr/libexec/rpm-ostree \ | ||
-DSYSCONF_INSTALL_DIR:PATH=/usr/libexec/rpm-ostree/etc \ | ||
-DSHARE_INSTALL_PREFIX:PATH=/usr/libexec/rpm-ostree/share \ | ||
-DENABLE_STATIC:BOOL=1 \ | ||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \ | ||
-DWITH_SWDB:BOOL=0 \ | ||
-DWITH_BINDINGS:BOOL=0 \ | ||
-DWITH_HTML:BOOL=0 \ | ||
-DWITH_MAN:BOOL=0 \ | ||
-DWITH_GIR:BOOL=0 \ | ||
${cmake_args} ../libdnf) || exit 1 | ||
|
||
AC_CONFIG_FILES([ | ||
Makefile | ||
api-doc/Makefile | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,30 @@ name = "libdnf-sys" | |
version = "0.1.0" | ||
authors = ["Colin Walters <[email protected]>", "Jonathan Lebon <[email protected]>"] | ||
edition = "2018" | ||
links = "dnf" | ||
|
||
[dependencies] | ||
libc = "0.2" | ||
|
||
[lib] | ||
name = "libdnf_sys" | ||
path = "lib.rs" | ||
|
||
[build-dependencies] | ||
cmake = "0.1.45" | ||
system-deps = "2.0" | ||
anyhow = "1.0" | ||
|
||
# This currently needs to duplicate the libraries from libdnf | ||
[package.metadata.system-deps] | ||
rpm = "4" | ||
# libdnf dependencies | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor: guess this comment is redundant now that it lives in the libdnf crate. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Will fix this in a followup, hoping to get this in and avoid restarting CI 3-4 times again) |
||
librepo = "1" | ||
libsolv = "0.7" | ||
libsolvext = "0.7" | ||
gpgme = "1" | ||
openssl = "1" | ||
libcurl = "7" | ||
sqlite3 = "3" | ||
modulemd = { name = "modulemd-2.0", version = "2" } | ||
jsonc = { name = "json-c", version = "0" } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use anyhow::Result; | ||
|
||
fn main() -> Result<()> { | ||
system_deps::Config::new().probe()?; | ||
use cmake::Config; | ||
let libdnf = Config::new("../../libdnf") | ||
// Needed for hardened builds | ||
.cxxflag("-fPIC") | ||
// I picked /usr/libexec/rpm-ostree just because we need an | ||
// arbitrary path - we don't actually install there. | ||
Comment on lines
+9
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we drop these There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It'd default to |
||
.define("CMAKE_INSTALL_PREFIX:PATH", "/usr/libexec/rpm-ostree") | ||
.define( | ||
"INCLUDE_INSTALL_DIR:PATH", | ||
"/usr/libexec/rpm-ostree/include", | ||
) | ||
.define("LIB_INSTALL_DIR:PATH", "/usr/libexec/rpm-ostree") | ||
.define("SYSCONF_INSTALL_DIR:PATH", "/usr/libexec/rpm-ostree/etc") | ||
.define("SHARE_INSTALL_PREFIX:PATH", "/usr/libexec/rpm-ostree/share") | ||
.define("ENABLE_STATIC:BOOL", "1") | ||
.define("CMAKE_POSITION_INDEPENDENT_CODE", "ON") | ||
// rpm-ostree maintains its own state | ||
.define("WITH_SWDB:BOOL", "0") | ||
// We don't need docs | ||
.define("WITH_HTML:BOOL", "0") | ||
.define("WITH_MAN:BOOL", "0") | ||
// Don't need bindings | ||
.define("WITH_BINDINGS:BOOL", "0") | ||
.define("WITH_GIR:BOOL", "0") | ||
.build_target("all") | ||
.build(); | ||
println!( | ||
"cargo:rustc-link-search=native={}/build/libdnf", | ||
libdnf.display() | ||
); | ||
println!("cargo:rustc-link-lib=static=dnf"); | ||
Ok(()) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// This is an awful hack necessary because this header file | ||
// is generated in the libdnf build, but we don't want to serialize | ||
// our C++ build waiting for that. Since we don't define the macros | ||
// like LIBDNF_MAJOR_VERSION, if anything depends on them it will | ||
// fail at build time. | ||
#pragma once | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incidentally https://blog.llvm.org/posts/2021-01-05-stack-clash-protection/