]> xenbits.xensource.com Git - xen-guest-agent.git/commitdiff
New "static" feature for libxenstore static linking
authorYann Dirson <yann.dirson@vates.fr>
Thu, 4 Jan 2024 13:35:53 +0000 (14:35 +0100)
committerYann Dirson <yann.dirson@vates.fr>
Wed, 24 Jan 2024 16:31:56 +0000 (17:31 +0100)
Now build linux release exe as static.

freebsd static-build configs disabled because apparently libxenstore.a
would need to be built with -fPIE.

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
.gitlab-ci.yml
CHANGELOG.md
Cargo.lock
Cargo.toml
debian/control
xen-guest-agent.spec.in

index 1b1ca488853ee1a7e94e7fe384a495c430f6bac8..a2d51e9f05a5c0e6da8356852f6e524da18f1515 100644 (file)
@@ -104,6 +104,9 @@ clippy:
           - "--no-default-features -F xenstore"
           - "--no-default-features -F net_netlink"
           - "--no-default-features -F net_pnet"
+          #
+          - "--no-default-features -F xenstore,static"
+          - "-F static"
 
 .featurematrix.no-netlink:
   parallel:
@@ -113,6 +116,10 @@ clippy:
           - "--no-default-features -F xenstore"
           - "--no-default-features -F net_pnet"
           - "--no-default-features -F xenstore,net_pnet"
+          ## this matrix is only by FreeBSD today, and we cannot link
+          ## statically on FreeBSD because libxenstore is not built as PIE
+          #- "--no-default-features -F xenstore,static"
+          #- "--no-default-features -F xenstore,static,net_pnet"
 
 ## standard jobs building with shipped Cargo.lock
 
@@ -196,7 +203,7 @@ build-release-linux-x86_64:
     - .debian-build-template
     - .not-scheduled
   variables:
-    FEATURES: ""
+    FEATURES: "-F static"
     CARGO_FLAGS: "--release"
   artifacts:
     paths:
index 083b88dc8aee1214b892b85327094a7e8aa94d61..1b81374ba2f357721c0a84b80f0dc2a9b5073a73 100644 (file)
@@ -5,6 +5,11 @@ Changelog](https://keepachangelog.com/en/1.0.0/)
 
 ## 0.4.0 - unreleased
 
+### new features
+
+* can be linked statically with libxenstore to distribute a more
+  standalone binary (`-F static`).  Used for official Linux binary.
+
 ### bugfixes
 
 * stale network information in xenstore is now removed on startup
index 9c5aa6c7e21665ade8ec2c45afc52a19f750248a..2c949245c895a8019d171fcce1c6b02008c02475 100644 (file)
@@ -745,6 +745,12 @@ version = "0.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
 
+[[package]]
+name = "pkg-config"
+version = "0.3.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a"
+
 [[package]]
 name = "pnet_base"
 version = "0.34.0"
@@ -1337,9 +1343,9 @@ dependencies = [
 
 [[package]]
 name = "xenstore-rs"
-version = "0.5.0"
+version = "0.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c26625ab5ad3e480cf74a06d0595229eadac95029270461b8143d59dc00ea7ff"
+checksum = "1a135aa89ea3a9c71af5448e1aae769ea8921e665d8acb6a5e9d098c5c6c1cc5"
 dependencies = [
  "libc",
  "libloading",
@@ -1349,9 +1355,10 @@ dependencies = [
 
 [[package]]
 name = "xenstore-sys"
-version = "0.1.4"
+version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c65a2d5fcc3634d9fdae6a388dbab071bf72ecf34ec530a705dca644dd60f543"
+checksum = "47d65d6ab4f4ac05cd61e78dee7cdb2d448d147c593aedeccf383d361af032f7"
 dependencies = [
  "bindgen",
+ "pkg-config",
 ]
index c4bb50ea0f2af2cde6bd31c08e2683b749edc64c..0bbfaea5a90e8853900fa526c7590fe2169f7e69 100644 (file)
@@ -14,7 +14,6 @@ netlink-packet-core = { version = "0.7.0", optional = true }
 netlink-packet-route = { version = "0.18.0", optional = true }
 netlink-proto = { version = "0.11.2", optional = true }
 rtnetlink = { version = "0.14.0", optional = true }
-xenstore-rs = { version = ">=0.4, <0.6", default-features = false, optional = true }
 async-stream = "0.3.4"
 os_info = { version = "3", default-features = false }
 pnet_datalink = { version = "*", optional = true }
@@ -24,6 +23,12 @@ log = "0.4.0"
 env_logger = ">=0.10.0"
 clap = { version = "4.4.8", features = ["derive"] }
 
+[dependencies.xenstore-rs]
+optional = true
+version = "0.6.0"
+#git = "https://github.com/Wenzel/xenstore.git"
+default-features = false
+
 [target.'cfg(unix)'.dependencies]
 uname = "0.1.1"
 syslog = "6.0"
@@ -34,6 +39,7 @@ sysctl = "0.5.0"
 [features]
 default = ["xenstore", "net_netlink"]
 xenstore = ["dep:xenstore-rs"]
+static = ["xenstore-rs/static"]
 net_netlink = ["dep:netlink-proto", "dep:netlink-packet-core", "dep:netlink-packet-route",
                "dep:rtnetlink"]
 net_pnet = ["dep:pnet_datalink", "dep:pnet_base", "dep:ipnetwork"]
index 4ca9962779f08732b7f0f80f13c2d7bc9125a91e..619c905fa34d06697bd9cd33882f9511b7505944 100644 (file)
@@ -13,7 +13,6 @@ Architecture: any
 Depends:
  ${shlibs:Depends},
  ${misc:Depends},
- libxenstore4 | libxenstore3.0,
 Conflicts: xe-guest-utilities
 Replaces: xe-guest-utilities
 Description: Guest Agent for Xen-based virtual machines
index 02d8313a559910fc6d1f0b6f242e077d9542101a..889785fc571ff78b887b1034fbea096f8121098a 100644 (file)
@@ -13,7 +13,6 @@ Source1:        xen-guest-agent.service
 
 BuildRequires:  systemd-devel
 
-Requires: xen-libs
 Conflicts: xe-guest-utilities
 
 %global _description %{expand: