Skip to content

Commit

Permalink
Move openssl bundling behind a feature
Browse files Browse the repository at this point in the history
  • Loading branch information
stormshield-kg committed Apr 15, 2024
1 parent e04db6c commit d8b519d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 15 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, macos-14, windows-2019]
features: [default, bundled, buildtime_bindgen]
features:
- default
- bundled
- bundled,bundled-openssl
- buildtime_bindgen
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
Expand Down Expand Up @@ -44,33 +48,32 @@ jobs:
sudo service postgresql restart && sleep 3
- name: Install postgres (MacOS)
if: matrix.os == 'macos-latest' && matrix.features != 'bundled'
if: matrix.os == 'macos-latest' && !contains(matrix.features, 'bundled')
run: |
initdb -D /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres start
sleep 3
createuser -s postgres
- name: Install postgres (MacOS M1)
if: matrix.os == 'macos-14' && matrix.features != 'bundled'
if: matrix.os == 'macos-14' && !contains(matrix.features, 'bundled')
run: |
brew install postgresql
brew services start postgresql@14
sleep 3
createuser -s postgres
- name: Install postgres (Windows)
if: runner.os == 'Windows' && matrix.features != 'bundled'
if: runner.os == 'Windows' && !contains(matrix.features, 'bundled')
shell: bash
run: |
choco install postgresql12 --force --params '/Password:root'
echo "C:\Program Files\PostgreSQL\12\bin" >> $GITHUB_PATH
echo "C:\Program Files\PostgreSQL\12\lib" >> $GITHUB_PATH
echo "PQ_LIB_DIR=C:\Program Files\PostgreSQL\12\lib" >> $GITHUB_ENV
- name: Windows setup (bundled)
if: runner.os == 'Windows' && matrix.features == 'bundled'
if: runner.os == 'Windows' && contains(matrix.features, 'bundled')
shell: bash
run: |
echo "OPENSSL_RUST_USE_NASM=0" >> $GITHUB_ENV
Expand Down Expand Up @@ -107,7 +110,7 @@ jobs:
- name: Test all files included
shell: bash
if: matrix.features == 'bundled'
if: contains(matrix.features, 'bundled')
run: |
rm -rf test_diesel
git reset --hard HEAD
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ All user visible changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/), as described
for Rust libraries in [RFC #1105](https://github.com/rust-lang/rfcs/blob/master/text/1105-api-evolution.md)

## Unreleased

## Changed

* The `bundled` feature of `pq-sys` no longer build a bundled version of `openssl`.
To bundle `openssl` when compiling `libpq` from source, both features `bundled` and `bundled-openssl` should be used.

## pq-src [0.1.6] 2024-04-12

## Changed
Expand All @@ -17,7 +24,7 @@ for Rust libraries in [RFC #1105](https://github.com/rust-lang/rfcs/blob/master/

## pq-src [0.1.4] 2024-04-05

## Changed
## Changed

* Readded `strlcat` on linux as well

Expand Down
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ vcpkg = "0.2.6"

[features]
default = []
bundled = ["pq-src"]
bundled = ["pq-src"]
bundled-openssl = ["pq-src?/openssl-vendored"]
buildtime_bindgen = ["dep:bindgen"]
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ The build script instructs Cargo to link the library statically if the environme
variable `PQ_LIB_STATIC` is set. This can be useful, if targeting for a musl target.
If pkg-config is being used, it's configuration options will apply.

### Features

* `buildtime_bindgen`: Run `bindgen` at build-time to generate bindings using installed headers. Not compatible with the `bundled` feature.
* `bundled`: Build the bundled version of `libpq` from source.
* `bundled-openssl`: Build a static version of `openssl` when compiling `libpq` from source.

## FAQ

### I'm seeing `dyld: Symbol not found __cg_jpeg_resync_to_restart` on macOS
Expand Down
8 changes: 2 additions & 6 deletions pq-src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,13 @@ keywords = ["bindings", "libpq", "pq-sys", "bundled"]
categories = ["database", "external-ffi-bindings"]
readme = "README.md"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[target.'cfg(not(target_os = "windows"))'.dependencies]
openssl-sys = { version = "0.9.93", features = ["vendored"] }
openssl-sys = "0.9.93"

[build-dependencies]
cc = "1.0.83"

[target.'cfg(not(target_os = "windows"))'.build-dependencies]
openssl-src = "300.0.0"

[features]
default = []
with-asan = []
openssl-vendored = ["openssl-sys/vendored"]

0 comments on commit d8b519d

Please sign in to comment.