aboutsummaryrefslogtreecommitdiffhomepage
path: root/ruby/ext/protobuf_c/extconf.rb
blob: 7f23b1a8290903394c5d3d6ee52704537bebaf30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/ruby

require 'mkmf'

upb_path = File.absolute_path(File.dirname($0)) + "/../../../upb"
libs = ["upb_pic", "upb.pb_pic", "upb.json_pic"]
system("cd #{upb_path}; make " + libs.map{|l| "lib/lib#{l}.a"}.join(" "))

$CFLAGS += " -O3 -std=c99 -Wno-unused-function -DNDEBUG"

find_header("upb/upb.h", upb_path) or
  raise "Can't find upb headers"
find_library("upb_pic", "upb_msgdef_new", upb_path + "/lib") or
  raise "Can't find upb lib"
find_library("upb.pb_pic", "upb_pbdecoder_init", upb_path + "/lib") or
  raise "Can't find upb.pb lib"
find_library("upb.json_pic", "upb_json_printer_init", upb_path + "/lib") or
  raise "Can't find upb.pb lib"

$objs = ["protobuf.o", "defs.o", "storage.o", "message.o",
         "repeated_field.o", "encode_decode.o"]

create_makefile("protobuf_c")