From f14f4268282530cd69ca214ea4a0bd8515c1186b Mon Sep 17 00:00:00 2001 From: Phillip Toland Date: Mon, 10 Aug 2009 12:44:09 -0500 Subject: [PATCH] Download the BDB source code on demand. --- .gitignore | 1 + Rakefile | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e905fa8..c5b7e0f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ test/test.cover int_test/test.cover bdberl-* priv/mibs +c_src/db-*.tar.gz diff --git a/Rakefile b/Rakefile index 5a5707d..e6da905 100644 --- a/Rakefile +++ b/Rakefile @@ -22,19 +22,31 @@ require 'erlbox' require 'erlbox/driver' require 'erlbox/snmp' +require 'net/http' CLOBBER.include %w( c_src/system ) UNIT_TEST_FLAGS << '+A10' INT_TEST_FLAGS << '+A10' +DB_TARBALL = 'c_src/db-4.7.25.tar.gz' DB_LIB = "c_src/system/lib/libdb.a" CC_FLAGS << "-Ic_src/system/include -pthread" LD_LIBS << DB_LIB LD_FLAGS << "-pthread" -file DB_LIB do +file DB_TARBALL do + puts "Downloading BerkeleyDB..." + # Not the fastest or most efficient method, but it works everywhere... + # This does not rely on curl or wget being installed. + Net::HTTP.start('download.oracle.com') do |http| + resp = http.get('/berkeley-db/db-4.7.25.tar.gz') + open(DB_TARBALL, "wb") {|file| file.write(resp.body) } + end +end + +file DB_LIB => DB_TARBALL do sh "cd c_src && ./buildlib.sh 2>&1" end