Skip to content

Commit

Permalink
build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
divi255 committed Dec 12, 2023
1 parent 5a721a3 commit db4f29a
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 24 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
_build
target
target-aarch64-musl
target-x86_64-musl
license.key
src/replication.rs
7 changes: 4 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "psrt"
version = "0.2.1"
version = "0.2.2"
edition = "2021"
authors = ["Serhij S. <div@altertech.com>"]
license = "Apache-2.0"
Expand Down Expand Up @@ -77,6 +77,7 @@ parking_lot = "0.12.1"
async-trait = "0.1.74"
eva-sdk = "0.3.10"
once_cell = "1.18.0"
eva-common = "0.3.17"

[features]
#default = ["server"]
Expand All @@ -87,5 +88,5 @@ cli = ["bma-benchmark", "byte-unit", "clap", "clap_derive", "env_logger",
server = ["base64", "bcrypt", "clap", "clap_derive", "colored", "chrono", "fork",
"hostname", "hyper", "serde_json", "syslog", "jemallocator", "submap/native-digest"]
crypto = ["aes-gcm", "rand"]
openssl-vendored = ["openssl/vendored"]
openssl-vendored = ["openssl/vendored", "eva-common/openssl-no-fips"]
std-alloc = []
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ all:
clean:
rm -rf _build
cargo clean
rm -rf target*

tag:
git tag -a v${VERSION} -m v${VERSION}
Expand All @@ -30,17 +31,17 @@ pkg:
lsb_release -cs|grep ^focal$
rm -rf _build
mkdir -p _build
cross build --target x86_64-unknown-linux-musl --release --features server,cli,openssl-vendored
cross build --target aarch64-unknown-linux-musl --release --features server,cli,openssl-vendored
CARGO_TARGET_DIR=target-x86_64-musl cross build --target x86_64-unknown-linux-musl --release --features server,cli,openssl-vendored
CARGO_TARGET_DIR=target-aarch64-musl cross build --target aarch64-unknown-linux-musl --release --features server,cli,openssl-vendored
cargo build --release --features server,cli
cd target/x86_64-unknown-linux-musl/release && tar czvf ../../../_build/psrt-${VERSION}-x86_64-musl.tar.gz psrtd psrt-cli
cd target/aarch64-unknown-linux-musl/release && \
cd target-x86_64-musl/x86_64-unknown-linux-musl/release && tar czvf ../../../_build/psrt-${VERSION}-x86_64-musl.tar.gz psrtd psrt-cli
cd target-aarch64-musl/aarch64-unknown-linux-musl/release && \
aarch64-linux-gnu-strip psrtd && \
aarch64-linux-gnu-strip psrt-cli && \
tar czvf ../../../_build/psrt-${VERSION}-aarch64-musl.tar.gz psrtd psrt-cli

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

Expand All @@ -55,7 +56,7 @@ release-enterprise:
DOCKER_OPTS="-v /opt/eva4-enterprise:/opt/eva4-enterprise" cross build --target x86_64-unknown-linux-musl --release --features cli,cluster,openssl-vendored
cargo build --release --features cluster,cli
cd make-deb && \
./build.sh enterprise && \
TARGET_DIR=target-x86_64-musl ./build.sh enterprise && \
PACKAGE_SUFFIX=-ubuntu20.04 RUST_TARGET=. ./build.sh enterprise && \
gsutil cp -a public-read psrt-enterprise-${VERSION}-amd64.deb gs://pub.bma.ai/psrt-enterprise/ && \
gsutil cp -a public-read psrt-enterprise-${VERSION}-amd64-ubuntu20.04.deb gs://pub.bma.ai/psrt-enterprise/
Expand Down
27 changes: 14 additions & 13 deletions make-deb/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@ fi

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

rm -rf "./${TARGET}"
mkdir -p ./${TARGET}/usr/bin
mkdir -p ./${TARGET}/usr/sbin
mkdir -p ./${TARGET}/lib/systemd/system
mkdir -p ./${TARGET}/DEBIAN
cp -vf ${PSRT}/target/${RUST_TARGET}/release/psrt-cli ./${TARGET}/usr/bin/
cp -vf ${PSRT}/target/${RUST_TARGET}/release/psrtd ./${TARGET}/usr/sbin/
cp -vf ${PSRT}/psrtd.service ./${TARGET}/lib/systemd/system/
cp -rvf ./etc ./${TARGET}/
strip ./${TARGET}/usr/bin/psrt-cli
strip ./${TARGET}/usr/sbin/psrtd
mkdir -p "./${TARGET}/usr/bin"
mkdir -p "./${TARGET}/usr/sbin"
mkdir -p "./${TARGET}/lib/systemd/system"
mkdir -p "./${TARGET}/DEBIAN"
cp -vf "${PSRT}/${TARGET_DIR}/${RUST_TARGET}/release/psrt-cli" "./${TARGET}/usr/bin/"
cp -vf "${PSRT}/${TARGET_DIR}/${RUST_TARGET}/release/psrtd" "./${TARGET}/usr/sbin/"
cp -vf "${PSRT}/psrtd.service" "./${TARGET}/lib/systemd/system/"
cp -rvf ./etc "./${TARGET}/"
strip "./${TARGET}/usr/bin/psrt-cli"
strip "./${TARGET}/usr/sbin/psrtd"
(
cat << EOF
Package: ${PACKAGE}
Expand All @@ -36,6 +37,6 @@ Architecture: amd64
Maintainer: Serhij S. <div@altertech.com>
Description: Industrial Pub-Sub server with minimal latency and MQTT-compatible logic
EOF
) > ./${TARGET}/DEBIAN/control
cp -vf ./debian/* ./${TARGET}/DEBIAN/
dpkg-deb --build ./${TARGET}
) > "./${TARGET}/DEBIAN/control"
cp -vf ./debian/* "./${TARGET}/DEBIAN/"
dpkg-deb --build "./${TARGET}"
4 changes: 4 additions & 0 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1544,8 +1544,12 @@ fn main() {
.expect("Unable to parse config path");
let config: Config = serde_yaml::from_str(&cfg).unwrap();
if config.proto.fips {
#[cfg(not(feature = "openssl-vendored"))]
openssl::fips::enable(true).expect("Can not enable OpenSSL FIPS 140");
#[cfg(not(feature = "openssl-vendored"))]
info!("OpenSSL FIPS 140 enabled");
#[cfg(feature = "openssl-vendored")]
panic!("FIPS can not be enabled, consider using a native OS distribution");
}
if opts.daemonize {
if let Ok(fork::Fork::Child) = fork::daemon(true, false) {
Expand Down

0 comments on commit db4f29a

Please sign in to comment.