source: branches/r9/lang/ruby/build.rb.in @ 4861

Last change on this file since 4861 was 4861, checked in by gah, 10 years ago
File size: 2.9 KB
Line 
1#
2# build.rb
3# Configure and build Rappture extension
4
5##############################################################################
6# The configure script should set these local configuration options.
7# These are options which Ruby would not know (e.g. Rappture, C++).
8
9rappture_dir  = "@prefix@"
10cxx           = "@CXX@"
11cxxflags      = "@CXXFLAGS@"
12srcdir        = "@srcdir@"
13libdir        = "@libdir@"
14includedir    = "@includedir@"
15install       = "@INSTALL@"
16shlib_cflags  = "@SHLIB_CFLAGS@"
17shlib_ldflags  = "@SHLIB_LDFLAGS@"
18
19##############################################################################
20# Get the remaining configuration options from the Config module, created
21# during the Ruby installation process.
22
23require 'rbconfig'
24
25objext        = Config::CONFIG["OBJEXT"]
26dlext         = Config::CONFIG["DLEXT"]
27rubydir       = Config::CONFIG["prefix"]
28rb_archdir    = Config::CONFIG["archdir"]
29sitedir       = Config::CONFIG["sitedir"]
30ldshared      = Config::CONFIG["LDSHARED"]
31ldflags       = Config::CONFIG["LDFLAGS"]
32libs          = Config::CONFIG["LIBS"]
33cxx_dlflags   = Config::CONFIG["CCDLFLAGS"]  # XXX This is for CC, not CXX
34
35##############################################################################
36# Values needed in Makefile
37
38source        = "Ruby_Rappture"
39target        = "Rappture"
40exceptions    = "-DRAISE_EXCEPTIONS"
41
42##############################################################################
43# Create Makefile
44
45f = File.new("Makefile.ruby", "w")
46f.printf("\n")
47f.printf("srcdir        = #{srcdir}\n")
48f.printf("incdir        = $(RAPPTURE_DIR)/include\n")
49f.printf("archdir       = #{rb_archdir}\n")
50f.printf("SOURCE        = #{source}\n")
51f.printf("TARGET        = #{target}\n\n")
52f.printf("OBJEXT        = #{objext}\n")
53f.printf("DLEXT         = #{dlext}\n\n")
54f.printf("RAPPTURE_DIR  = #{rappture_dir}\n")
55f.printf("RUBY_DIR      = #{rubydir}\n")
56f.printf("SITE_DIR      = #{sitedir}\n\n")
57f.printf("SITE_DIR      = $(RAPPTURE_DIR)/lib/ruby/ruby_site\n\n")
58f.printf("CXX           = #{cxx}\n")
59f.printf("CFLAGS        = #{cxxflags}\n")
60f.printf("CXX_DLFLAGS   = #{cxx_dlflags}\n")
61f.printf("INCLUDES      = -I$(incdir) -I#{includedir} -I$(archdir)/\n")
62f.printf("INSTALL       = #{install}\n")
63f.printf("SHLIB_FLAGS   = $(CFLAGS) $(CXX_DLFLAGS) $(LDFLAGS) $(INCLUDES)\n\n")
64f.printf("EXCEPTIONS    = #{exceptions}\n\n")
65f.printf("SHLIB_LD      = #{ldshared}\n")
66f.printf("LDFLAGS       = #{ldflags}\n")
67f.printf("LIBS          = -L#{libdir} -lrappture #{libs}\n\n")
68f.printf("package       = $(TARGET).$(DLEXT)\n\n")
69f.printf("all: extension\n\n")
70f.printf("extension: $(package)\n")
71f.printf("$(package): $(srcdir)/$(SOURCE).cc\n")
72f.printf("      $(SHLIB_LD) $(SHLIB_FLAGS) $(EXCEPTIONS) $< -o $@ $(LIBS)\n\n")
73f.printf("install: $(package)\n")
74f.printf("      $(INSTALL) -m 0755 $(package) $(SITE_DIR)\n\n")
75f.close
76 
77##############################################################################
78# Build the extension
79
80#`make extension`
81#`make install`
82
Note: See TracBrowser for help on using the repository browser.