Skip to content

Commit 96221c8

Browse files
committed
Switch over to Makefile based builds
Rustpkg is not really usable
1 parent b030a0b commit 96221c8

7 files changed

Lines changed: 45 additions & 16 deletions

File tree

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
/.rust/
21
/doc/
3-
/test
4-
/rust-postgres
2+
/build/

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "submodules/rust-openssl"]
2+
path = submodules/rust-openssl
3+
url = git://github.com/sfackler/rust-openssl

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ before_script:
99
- ./travis/setup.sh
1010
script:
1111
- make
12-
- make test
12+
- make check

Makefile

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,41 @@
1-
RUSTPKG ?= rustpkg
2-
RUSTC ?= rustc
3-
RUST_FLAGS ?= -Z debug-info -O
1+
export RUSTC = rustc
2+
BUILDDIR = build
3+
export RUSTFLAGS = -O -Z debug-info
44

5-
all:
6-
$(RUSTPKG) $(RUST_FLAGS) install
5+
POSTGRES_LIB = lib.rs
6+
POSTGRES = $(BUILDDIR)/$(shell $(RUSTC) --crate-file-name $(POSTGRES_LIB))
7+
POSTGRES_TEST = $(BUILDDIR)/$(shell $(RUSTC) --test --crate-file-name $(POSTGRES_LIB))
8+
OPENSSL_DIR = submodules/rust-openssl
9+
OPENSSL = $(OPENSSL_DIR)/$(shell $(MAKE) -s -C $(OPENSSL_DIR) print-target)
710

8-
test:
9-
$(RUSTC) $(RUST_FLAGS) --test lib.rs
10-
./rust-postgres
11+
all: $(POSTGRES)
1112

12-
.PHONY: test
13+
-include $(BUILDDIR)/postgres.d
14+
-include $(BUILDDIR)/postgres_test.d
15+
16+
$(BUILDDIR):
17+
mkdir -p $@
18+
19+
$(BUILDDIR)/rust-openssl-trigger: submodules/rust-openssl-trigger | $(BUILDDIR)
20+
git submodule init
21+
git submodule update
22+
touch $@
23+
24+
$(OPENSSL): $(BUILDDIR)/rust-openssl-trigger | $(BUILDDIR)
25+
$(MAKE) -C $(OPENSSL_DIR)
26+
27+
$(POSTGRES): $(POSTGRES_LIB) $(OPENSSL) | $(BUILDDIR)
28+
$(RUSTC) $(RUSTFLAGS) --dep-info $(@D)/postgres.d --out-dir $(@D) \
29+
-L $(dir $(OPENSSL)) $<
30+
31+
$(POSTGRES_TEST): $(POSTGRES_LIB) $(OPENSSL) | $(BUILDDIR)
32+
$(RUSTC) $(RUSTFLAGS) --dep-info $(@D)/postgres_test.d --out-dir $(@D) \
33+
-L $(dir $(OPENSSL)) --test $<
34+
35+
check: $(POSTGRES_TEST)
36+
$<
1337

1438
clean:
15-
rm -rf .rust rust-postgres rust-postgres.dSYM
39+
rm -rf $(BUILDDIR)
40+
41+
.PHONY: all check clean

lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn main() {
5555
```
5656
*/
5757

58-
#[crate_id="github.com/sfackler/rust-postgres"];
58+
#[crate_id="github.com/sfackler/rust-postgres#postgres:0.0"];
5959
#[crate_type="lib"];
6060
#[doc(html_root_url="http://sfackler.github.io/rust-postgres/doc/")];
6161

@@ -65,7 +65,7 @@ fn main() {
6565
#[macro_escape];
6666

6767
extern mod extra;
68-
extern mod openssl = "github.com/sfackler/rust-openssl";
68+
extern mod openssl;
6969

7070
use extra::container::Deque;
7171
use extra::hex::ToHex;

submodules/rust-openssl

Submodule rust-openssl added at f624349

submodules/rust-openssl-trigger

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Sat Jan 18 13:39:47 PST 2014

0 commit comments

Comments
 (0)