-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathodb.rb
63 lines (53 loc) · 1.72 KB
/
odb.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
class Odb < Formula
homepage "http://www.codesynthesis.com/products/odb/"
url "http://www.codesynthesis.com/download/odb/2.4/odb-2.4.0.tar.gz"
sha256 "169103a7829b9d8b2fdf5c267d18acc3d47c964d355c7af335d75c63b29c52b5"
if MacOS.version <= :el_capitan
depends_on "gcc@5"
else
depends_on "[email protected]"
end
depends_on "libcutl" => "with-gcc"
depends_on "libodb"
fails_with :clang do
cause "ODB is a GCC plugin"
end
def install
File.open("doc/default.options", "w") do |f|
f << "# Default ODB options file. This file is automatically loaded by the ODB\n"
f << "# compiler and can be used for installation-wide customizations, such as\n"
f << "# adding an include search path for a commonly used library. For example:\n"
f << "#\n"
f << "# -I /opt/boost_1_45_0\n"
f << "#\n"
f << "\n"
f << "# -x -I/usr/local/include\n"
end
system "./configure", "--prefix=#{prefix}",
"--libexecdir=#{lib}",
"--with-options-file=#{prefix}/etc/odb/default.options",
"CXXFLAGS=-fno-devirtualize"
system "make", "install"
(prefix/"etc/odb").install "doc/default.options"
end
test do
(testpath/"test.hxx").write <<-EOS
#include <odb/core.hxx>
#pragma db object
class person
{
private:
#pragma db id auto
unsigned long id_;
unsigned short age_;
friend class odb::access;
person(){}
public:
person (unsigned short age):age_(age){}
unsigned short age()const{return age_;}
void age(unsigned short age){age_=age;}
};
EOS
system "odb", "-d", "sqlite", "-s", "-q", "test.hxx"
end
end