Skip to content

Commit db4f29a

Browse files
committed
build fixes
1 parent 5a721a3 commit db4f29a

File tree

6 files changed

+34
-24
lines changed

6 files changed

+34
-24
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
_build
22
target
3+
target-aarch64-musl
4+
target-x86_64-musl
35
license.key
46
src/replication.rs

Cargo.lock

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "psrt"
3-
version = "0.2.1"
3+
version = "0.2.2"
44
edition = "2021"
55
authors = ["Serhij S. <div@altertech.com>"]
66
license = "Apache-2.0"
@@ -77,6 +77,7 @@ parking_lot = "0.12.1"
7777
async-trait = "0.1.74"
7878
eva-sdk = "0.3.10"
7979
once_cell = "1.18.0"
80+
eva-common = "0.3.17"
8081

8182
[features]
8283
#default = ["server"]
@@ -87,5 +88,5 @@ cli = ["bma-benchmark", "byte-unit", "clap", "clap_derive", "env_logger",
8788
server = ["base64", "bcrypt", "clap", "clap_derive", "colored", "chrono", "fork",
8889
"hostname", "hyper", "serde_json", "syslog", "jemallocator", "submap/native-digest"]
8990
crypto = ["aes-gcm", "rand"]
90-
openssl-vendored = ["openssl/vendored"]
91+
openssl-vendored = ["openssl/vendored", "eva-common/openssl-no-fips"]
9192
std-alloc = []

Makefile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ all:
66
clean:
77
rm -rf _build
88
cargo clean
9+
rm -rf target*
910

1011
tag:
1112
git tag -a v${VERSION} -m v${VERSION}
@@ -30,17 +31,17 @@ pkg:
3031
lsb_release -cs|grep ^focal$
3132
rm -rf _build
3233
mkdir -p _build
33-
cross build --target x86_64-unknown-linux-musl --release --features server,cli,openssl-vendored
34-
cross build --target aarch64-unknown-linux-musl --release --features server,cli,openssl-vendored
34+
CARGO_TARGET_DIR=target-x86_64-musl cross build --target x86_64-unknown-linux-musl --release --features server,cli,openssl-vendored
35+
CARGO_TARGET_DIR=target-aarch64-musl cross build --target aarch64-unknown-linux-musl --release --features server,cli,openssl-vendored
3536
cargo build --release --features server,cli
36-
cd target/x86_64-unknown-linux-musl/release && tar czvf ../../../_build/psrt-${VERSION}-x86_64-musl.tar.gz psrtd psrt-cli
37-
cd target/aarch64-unknown-linux-musl/release && \
37+
cd target-x86_64-musl/x86_64-unknown-linux-musl/release && tar czvf ../../../_build/psrt-${VERSION}-x86_64-musl.tar.gz psrtd psrt-cli
38+
cd target-aarch64-musl/aarch64-unknown-linux-musl/release && \
3839
aarch64-linux-gnu-strip psrtd && \
3940
aarch64-linux-gnu-strip psrt-cli && \
4041
tar czvf ../../../_build/psrt-${VERSION}-aarch64-musl.tar.gz psrtd psrt-cli
4142

4243
debian-pkg:
43-
cd make-deb && ./build.sh && mv psrt-${VERSION}-amd64.deb ../_build/
44+
cd make-deb && TARGET_DIR=target-x86_64-musl ./build.sh && mv psrt-${VERSION}-amd64.deb ../_build/
4445
cd make-deb && PACKAGE_SUFFIX=-ubuntu20.04 RUST_TARGET=. ./build.sh && \
4546
mv psrt-${VERSION}-amd64-ubuntu20.04.deb ../_build/
4647

@@ -55,7 +56,7 @@ release-enterprise:
5556
DOCKER_OPTS="-v /opt/eva4-enterprise:/opt/eva4-enterprise" cross build --target x86_64-unknown-linux-musl --release --features cli,cluster,openssl-vendored
5657
cargo build --release --features cluster,cli
5758
cd make-deb && \
58-
./build.sh enterprise && \
59+
TARGET_DIR=target-x86_64-musl ./build.sh enterprise && \
5960
PACKAGE_SUFFIX=-ubuntu20.04 RUST_TARGET=. ./build.sh enterprise && \
6061
gsutil cp -a public-read psrt-enterprise-${VERSION}-amd64.deb gs://pub.bma.ai/psrt-enterprise/ && \
6162
gsutil cp -a public-read psrt-enterprise-${VERSION}-amd64-ubuntu20.04.deb gs://pub.bma.ai/psrt-enterprise/

make-deb/build.sh

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,19 @@ fi
1414

1515
TARGET="${PACKAGE}-${VERSION}-amd64${PACKAGE_SUFFIX}"
1616
[ -z "${RUST_TARGET}" ] && RUST_TARGET=x86_64-unknown-linux-musl
17+
[ -z "${TARGET_DIR}" ] && TARGET_DIR=target
1718

1819
rm -rf "./${TARGET}"
19-
mkdir -p ./${TARGET}/usr/bin
20-
mkdir -p ./${TARGET}/usr/sbin
21-
mkdir -p ./${TARGET}/lib/systemd/system
22-
mkdir -p ./${TARGET}/DEBIAN
23-
cp -vf ${PSRT}/target/${RUST_TARGET}/release/psrt-cli ./${TARGET}/usr/bin/
24-
cp -vf ${PSRT}/target/${RUST_TARGET}/release/psrtd ./${TARGET}/usr/sbin/
25-
cp -vf ${PSRT}/psrtd.service ./${TARGET}/lib/systemd/system/
26-
cp -rvf ./etc ./${TARGET}/
27-
strip ./${TARGET}/usr/bin/psrt-cli
28-
strip ./${TARGET}/usr/sbin/psrtd
20+
mkdir -p "./${TARGET}/usr/bin"
21+
mkdir -p "./${TARGET}/usr/sbin"
22+
mkdir -p "./${TARGET}/lib/systemd/system"
23+
mkdir -p "./${TARGET}/DEBIAN"
24+
cp -vf "${PSRT}/${TARGET_DIR}/${RUST_TARGET}/release/psrt-cli" "./${TARGET}/usr/bin/"
25+
cp -vf "${PSRT}/${TARGET_DIR}/${RUST_TARGET}/release/psrtd" "./${TARGET}/usr/sbin/"
26+
cp -vf "${PSRT}/psrtd.service" "./${TARGET}/lib/systemd/system/"
27+
cp -rvf ./etc "./${TARGET}/"
28+
strip "./${TARGET}/usr/bin/psrt-cli"
29+
strip "./${TARGET}/usr/sbin/psrtd"
2930
(
3031
cat << EOF
3132
Package: ${PACKAGE}
@@ -36,6 +37,6 @@ Architecture: amd64
3637
Maintainer: Serhij S. <div@altertech.com>
3738
Description: Industrial Pub-Sub server with minimal latency and MQTT-compatible logic
3839
EOF
39-
) > ./${TARGET}/DEBIAN/control
40-
cp -vf ./debian/* ./${TARGET}/DEBIAN/
41-
dpkg-deb --build ./${TARGET}
40+
) > "./${TARGET}/DEBIAN/control"
41+
cp -vf ./debian/* "./${TARGET}/DEBIAN/"
42+
dpkg-deb --build "./${TARGET}"

src/server.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,8 +1544,12 @@ fn main() {
15441544
.expect("Unable to parse config path");
15451545
let config: Config = serde_yaml::from_str(&cfg).unwrap();
15461546
if config.proto.fips {
1547+
#[cfg(not(feature = "openssl-vendored"))]
15471548
openssl::fips::enable(true).expect("Can not enable OpenSSL FIPS 140");
1549+
#[cfg(not(feature = "openssl-vendored"))]
15481550
info!("OpenSSL FIPS 140 enabled");
1551+
#[cfg(feature = "openssl-vendored")]
1552+
panic!("FIPS can not be enabled, consider using a native OS distribution");
15491553
}
15501554
if opts.daemonize {
15511555
if let Ok(fork::Fork::Child) = fork::daemon(true, false) {

0 commit comments

Comments
 (0)