From 96221c8a47fd07eb7058f4c04b85eb195470a39c Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sat, 18 Jan 2014 13:46:39 -0800 Subject: [PATCH] Switch over to Makefile based builds Rustpkg is not really usable --- .gitignore | 4 +-- .gitmodules | 3 +++ .travis.yml | 2 +- Makefile | 46 ++++++++++++++++++++++++++------- lib.rs | 4 +-- submodules/rust-openssl | 1 + submodules/rust-openssl-trigger | 1 + 7 files changed, 45 insertions(+), 16 deletions(-) create mode 100644 .gitmodules create mode 160000 submodules/rust-openssl create mode 100644 submodules/rust-openssl-trigger diff --git a/.gitignore b/.gitignore index e55239f9..21285183 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ -/.rust/ /doc/ -/test -/rust-postgres +/build/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..aca9c587 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "submodules/rust-openssl"] + path = submodules/rust-openssl + url = git://github.com/sfackler/rust-openssl diff --git a/.travis.yml b/.travis.yml index 214d58ae..b26ac867 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,4 +9,4 @@ before_script: - ./travis/setup.sh script: - make - - make test + - make check diff --git a/Makefile b/Makefile index f8b7897b..2cde9777 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,41 @@ -RUSTPKG ?= rustpkg -RUSTC ?= rustc -RUST_FLAGS ?= -Z debug-info -O +export RUSTC = rustc +BUILDDIR = build +export RUSTFLAGS = -O -Z debug-info -all: - $(RUSTPKG) $(RUST_FLAGS) install +POSTGRES_LIB = lib.rs +POSTGRES = $(BUILDDIR)/$(shell $(RUSTC) --crate-file-name $(POSTGRES_LIB)) +POSTGRES_TEST = $(BUILDDIR)/$(shell $(RUSTC) --test --crate-file-name $(POSTGRES_LIB)) +OPENSSL_DIR = submodules/rust-openssl +OPENSSL = $(OPENSSL_DIR)/$(shell $(MAKE) -s -C $(OPENSSL_DIR) print-target) -test: - $(RUSTC) $(RUST_FLAGS) --test lib.rs - ./rust-postgres +all: $(POSTGRES) -.PHONY: test +-include $(BUILDDIR)/postgres.d +-include $(BUILDDIR)/postgres_test.d + +$(BUILDDIR): + mkdir -p $@ + +$(BUILDDIR)/rust-openssl-trigger: submodules/rust-openssl-trigger | $(BUILDDIR) + git submodule init + git submodule update + touch $@ + +$(OPENSSL): $(BUILDDIR)/rust-openssl-trigger | $(BUILDDIR) + $(MAKE) -C $(OPENSSL_DIR) + +$(POSTGRES): $(POSTGRES_LIB) $(OPENSSL) | $(BUILDDIR) + $(RUSTC) $(RUSTFLAGS) --dep-info $(@D)/postgres.d --out-dir $(@D) \ + -L $(dir $(OPENSSL)) $< + +$(POSTGRES_TEST): $(POSTGRES_LIB) $(OPENSSL) | $(BUILDDIR) + $(RUSTC) $(RUSTFLAGS) --dep-info $(@D)/postgres_test.d --out-dir $(@D) \ + -L $(dir $(OPENSSL)) --test $< + +check: $(POSTGRES_TEST) + $< clean: - rm -rf .rust rust-postgres rust-postgres.dSYM + rm -rf $(BUILDDIR) + +.PHONY: all check clean diff --git a/lib.rs b/lib.rs index 25230e8e..38dbcd73 100644 --- a/lib.rs +++ b/lib.rs @@ -55,7 +55,7 @@ fn main() { ``` */ -#[crate_id="github.com/sfackler/rust-postgres"]; +#[crate_id="github.com/sfackler/rust-postgres#postgres:0.0"]; #[crate_type="lib"]; #[doc(html_root_url="http://sfackler.github.io/rust-postgres/doc/")]; @@ -65,7 +65,7 @@ fn main() { #[macro_escape]; extern mod extra; -extern mod openssl = "github.com/sfackler/rust-openssl"; +extern mod openssl; use extra::container::Deque; use extra::hex::ToHex; diff --git a/submodules/rust-openssl b/submodules/rust-openssl new file mode 160000 index 00000000..f6243490 --- /dev/null +++ b/submodules/rust-openssl @@ -0,0 +1 @@ +Subproject commit f6243490d3f600f7eb6e60d5bcd00c24bc1ba2e8 diff --git a/submodules/rust-openssl-trigger b/submodules/rust-openssl-trigger new file mode 100644 index 00000000..fa83f507 --- /dev/null +++ b/submodules/rust-openssl-trigger @@ -0,0 +1 @@ +Sat Jan 18 13:39:47 PST 2014