extconf.rb 795 B

1234567891011121314151617181920212223
  1. #!/usr/bin/ruby
  2. require 'mkmf'
  3. upb_path = File.absolute_path(File.dirname($0)) + "/../../../upb"
  4. libs = ["upb_pic", "upb.pb_pic", "upb.json_pic"]
  5. system("cd #{upb_path}; make " + libs.map{|l| "lib/lib#{l}.a"}.join(" "))
  6. $CFLAGS += " -O3 -std=c99 -Wno-unused-function -DNDEBUG"
  7. find_header("upb/upb.h", upb_path) or
  8. raise "Can't find upb headers"
  9. find_library("upb_pic", "upb_msgdef_new", upb_path + "/lib") or
  10. raise "Can't find upb lib"
  11. find_library("upb.pb_pic", "upb_pbdecoder_init", upb_path + "/lib") or
  12. raise "Can't find upb.pb lib"
  13. find_library("upb.json_pic", "upb_json_printer_init", upb_path + "/lib") or
  14. raise "Can't find upb.pb lib"
  15. $objs = ["protobuf.o", "defs.o", "storage.o", "message.o",
  16. "repeated_field.o", "encode_decode.o"]
  17. create_makefile("protobuf_c")