Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions crates/pjsip-shim/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ fn build_pjproject_cffi() {
"\n\
============================================================\n\
pjsip-shim: the `pjproject-cffi` feature is enabled but the\n\
pjproject 2.16 source tree could not be found.\n\
pjproject 2.17 source tree could not be found.\n\
\n\
Provide it in one of these ways:\n\
1. Run scripts/fetch-pjproject.sh (downloads it into\n\
crates/pjsip-shim/vendor/pjproject-2.16), or\n\
2. Set PJPROJECT_DIR=/path/to/pjproject-2.16 when building.\n\
crates/pjsip-shim/vendor/pjproject-2.17), or\n\
2. Set PJPROJECT_DIR=/path/to/pjproject-2.17 when building.\n\
\n\
The directory must contain pjlib/include/pj/types.h.\n\
============================================================\n"
Expand Down Expand Up @@ -188,11 +188,11 @@ fn build_pjproject_cffi() {
}
}

/// Find the pjproject 2.16 source tree, in priority order:
/// Find the pjproject 2.17 source tree, in priority order:
/// 1. `$PJPROJECT_DIR`
/// 2. the vendored copy at `crates/pjsip-shim/vendor/pjproject-2.16`
/// 2. the vendored copy at `crates/pjsip-shim/vendor/pjproject-2.17`
/// (populated by `scripts/fetch-pjproject.sh`)
/// 3. `/tmp/pjproject-2.16` (historical default)
/// 3. `/tmp/pjproject-2.17` (historical default)
/// A directory only counts if `pjlib/include/pj/types.h` exists under it.
fn locate_pjproject() -> Option<PathBuf> {
let mut candidates: Vec<PathBuf> = Vec::new();
Expand All @@ -202,9 +202,9 @@ fn locate_pjproject() -> Option<PathBuf> {
}

let manifest_dir = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
candidates.push(manifest_dir.join("vendor/pjproject-2.16"));
candidates.push(manifest_dir.join("vendor/pjproject-2.17"));

candidates.push(PathBuf::from("/tmp/pjproject-2.16"));
candidates.push(PathBuf::from("/tmp/pjproject-2.17"));

candidates
.into_iter()
Expand Down
8 changes: 4 additions & 4 deletions scripts/fetch-pjproject.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env bash
#
# fetch-pjproject.sh -- download the pjproject 2.16 source tree that the
# fetch-pjproject.sh -- download the pjproject 2.17 source tree that the
# `pjsip-shim` crate compiles against when built with the `pjproject-cffi`
# feature.
#
# The tree is placed at crates/pjsip-shim/vendor/pjproject-2.16, which the
# The tree is placed at crates/pjsip-shim/vendor/pjproject-2.17, which the
# crate's build.rs auto-detects. That directory is git-ignored, so the
# third-party (GPL-2.0) sources are never committed to this repo.
#
Expand All @@ -13,11 +13,11 @@
# cargo build -p pjsip-shim --features pjproject-cffi --release
#
# Override the version or download URL via env vars if needed:
# PJ_VERSION=2.16 PJ_URL=https://.../2.16.tar.gz scripts/fetch-pjproject.sh
# PJ_VERSION=2.17 PJ_URL=https://.../2.17.tar.gz scripts/fetch-pjproject.sh
#
set -euo pipefail

PJ_VERSION="${PJ_VERSION:-2.16}"
PJ_VERSION="${PJ_VERSION:-2.17}"
PJ_URL="${PJ_URL:-https://github.com/pjsip/pjproject/archive/refs/tags/${PJ_VERSION}.tar.gz}"

# Resolve repo paths relative to this script so it works from any CWD.
Expand Down
Loading