-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uses a small script (`debian/build.sh`) to massage the output of cargo-c's build into a `.deb` that can be installed on Debian/Ubuntu systems.
- Loading branch information
Showing
3 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ librustls/cmake-build* | |
.idea | ||
.venv | ||
.vs | ||
debian/usr | ||
debian/DEBIAN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env bash | ||
set -eu | ||
set -x | ||
|
||
cd "$(dirname "$0")" | ||
|
||
VERSION=$(sed -n 's/^version = "\(.*\)"$/\1/p' ../librustls/Cargo.toml) | ||
if [ -z "$VERSION" ]; then | ||
echo "Failed to extract version from Cargo.toml" >&2 | ||
exit 1 | ||
fi | ||
|
||
PACKAGE="librustls" | ||
ARCH="amd64" | ||
DIST_DIR="/tmp/dist" | ||
DEB_ROOT="." | ||
|
||
CC=clang CXX=clang cargo cinstall --locked --features cert_compression --release --prefix "${DIST_DIR}" | ||
|
||
mkdir -p "${DEB_ROOT}/usr/"{lib,include} | ||
mkdir -p "${DEB_ROOT}/DEBIAN" | ||
|
||
cp -r "${DIST_DIR}/lib/"* "${DEB_ROOT}/usr/lib/" | ||
cp -r "${DIST_DIR}/include/"* "${DEB_ROOT}/usr/include/" | ||
|
||
sed -i "s|prefix=.*|prefix=/usr|" "${DEB_ROOT}/usr/lib/x86_64-linux-gnu/pkgconfig/rustls.pc" | ||
|
||
cat > "${DEB_ROOT}/DEBIAN/control" << EOF | ||
Package: ${PACKAGE} | ||
Version: ${VERSION} | ||
Architecture: ${ARCH} | ||
Maintainer: Daniel McCarney <[email protected]> | ||
Description: FFI bindings for the Rustls TLS library | ||
Section: libs | ||
Depends: libc6 | ||
Priority: optional | ||
EOF | ||
|
||
cat > "${DEB_ROOT}/DEBIAN/postinst" << EOF | ||
#!/bin/sh | ||
set -e | ||
ldconfig | ||
EOF | ||
chmod 755 "${DEB_ROOT}/DEBIAN/postinst" | ||
|
||
cd .. | ||
dpkg-deb --build debian "${PACKAGE}_${VERSION}_${ARCH}.deb" |