Skip to content

Commit 9744571

Browse files
committed
feat!: add nginx-src crate with vendored nginx sources
Fixes: #85
1 parent 8496ea7 commit 9744571

File tree

15 files changed

+724
-765
lines changed

15 files changed

+724
-765
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
steps:
3636
- name: checkout source
3737
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
38+
with:
39+
submodules: true
3840
- name: set up cargo cache
3941
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
4042
continue-on-error: false
@@ -90,6 +92,8 @@ jobs:
9092
steps:
9193
- name: checkout source
9294
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
95+
with:
96+
submodules: true
9397
- name: set up cargo cache
9498
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
9599
continue-on-error: false
@@ -124,6 +128,8 @@ jobs:
124128
- name: install command line dependencies
125129
run: brew install make gnupg
126130
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
131+
with:
132+
submodules: true
127133
- uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b
128134
with:
129135
toolchain: stable

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "nginx-src/nginx"]
2+
path = nginx-src/nginx
3+
url = https://github.com/nginx/nginx.git
4+
branch = stable-1.28

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[workspace]
22
members = [
3+
"nginx-src",
34
"nginx-sys",
45
"examples",
56
]

deny.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ all-features = true
66

77
[licenses]
88
allow = [
9-
"Apache-2.0 WITH LLVM-exception",
109
"Apache-2.0",
10+
"BSD-2-Clause",
1111
"BSD-3-Clause",
1212
"ISC",
1313
"MIT",

nginx-src/Cargo.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[package]
2+
name = "nginx-src"
3+
# Version format: <NGINX major>.<NGINX minor>.<crate patch>+<NGINX version>
4+
version = "1.28.0+1.28.0"
5+
# Crate sources are licensed under Apache-2.0, with exception of the
6+
# NGINX submodlue that is redistributed under BSD-2-Clause.
7+
license = "Apache-2.0 AND BSD-2-Clause"
8+
description = "Source of NGINX"
9+
keywords = ["nginx", "module", "sys"]
10+
edition.workspace = true
11+
homepage.workspace = true
12+
repository.workspace = true
13+
rust-version.workspace = true
14+
15+
[dependencies]
16+
duct = "1"
17+
flate2 = "1"
18+
tar = "0.4"
19+
ureq = "3.0.10"

nginx-src/LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../LICENSE

nginx-src/README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# nginx-src
2+
3+
This crate contains a vendored copy of the NGINX source and the logic to
4+
build it. It is intended to be consumed by the [nginx-sys] crate for CI
5+
builds, tests or rustdoc generation.
6+
7+
It is notably not intended for producing binaries suitable for production
8+
use. For such scenaros we recommend building the ngx-rust based module
9+
against prebuilt packages from <https://nginx.org/> or your preferred
10+
distribution. See the [nginx-sys] documentation for building ngx-rust
11+
modules against an existing pre-configured NGINX source tree.
12+
13+
[nginx-sys]: https://docs.rs/nginx-sys/
14+
15+
## Versioning
16+
17+
This crate follows the latest stable branch of NGINX.
18+
19+
* The major and minor fields are taken from the NGINX version.
20+
* The patch version is incremented on changes to the build logic or crate
21+
metadata.
22+
* The version metadata contains full version of NGINX.
23+
24+
## Build Requirements
25+
26+
The crate can be built on common Unix-like operating systems and requires
27+
all the usual NGINX build dependencies (including development headers
28+
for the libraries) installed in system paths:
29+
30+
* C compiler and toolchain
31+
* SSL library, OpenSSL or LibreSSL
32+
* PCRE or PCRE2
33+
* Zlib or zlib-ng witn Zlib compatibile API enabled
34+
35+
We don't intend to support Windows at the moment, as NGINX does not
36+
support dynamic modules for this target.
37+
38+
## Environment variables
39+
40+
Following variables can be set to customize the build.
41+
42+
* `NGX_CONFIGURE_ARGS` — additional arguments to pass to the NGINX configure
43+
script.
44+
45+
Example: `export NGX_CONFIGURE_ARGS='--with-debug'; cargo build`
46+
47+
* `NGX_CFLAGS`, `NGX_LDFLAGS` — additional C compiler and linker flags to pass
48+
to the NGINX configure script. Internally, this is added to the
49+
`--with-cc-opt=...` and `--with-ld-opt=...` arguments.
50+
51+
Example:
52+
```sh
53+
export NGX_CFLAGS='-I/opt/boringssl/include'
54+
export NGX_LDFLAGS='-L/opt/boringssl/build -lstdc++'
55+
cargo build
56+
```
57+
58+
Setting any of the following variables would result in downloading source
59+
archives from the network.
60+
61+
* `NGX_VERSION` — if specified, the version of NGINX to download and build
62+
instead of the one bundled with the crate.
63+
* `OPENSSL_VERSION` — if specified, the version of OpenSSL to download and
64+
use instead of the system-provided library.
65+
* `PCRE2_VERSION` — if specified, the version of PCRE2 to download and use
66+
instead of the system-provided library.
67+
* `ZLIB_VERSION` — if specified, the version of Zlib to download and use
68+
instead of the system-provided library.
69+
70+
## License
71+
72+
The code in this crate is licensed under [Apache License 2.0](./LICENSE).
73+
The crate also contains the source code of NGINX, distributed under the
74+
[BSD 2-Clause License](nginx/LICENSE).

nginx-src/nginx

Submodule nginx added at 481d28c

0 commit comments

Comments
 (0)