extconf.rb 677 B

1234567891011121314151617181920212223
  1. #!/usr/bin/ruby
  2. require 'mkmf'
  3. if RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/
  4. # XOPEN_SOURCE needed for strptime:
  5. # https://stackoverflow.com/questions/35234152/strptime-giving-implicit-declaration-and-undefined-reference
  6. $CFLAGS += " -std=c99 -O3 -DNDEBUG -D_XOPEN_SOURCE=700"
  7. else
  8. $CFLAGS += " -std=c99 -O3 -DNDEBUG"
  9. end
  10. if RUBY_PLATFORM =~ /linux/
  11. # Instruct the linker to point memcpy calls at our __wrap_memcpy wrapper.
  12. $LDFLAGS += " -Wl,-wrap,memcpy"
  13. end
  14. $objs = ["protobuf.o", "defs.o", "storage.o", "message.o",
  15. "repeated_field.o", "map.o", "encode_decode.o", "upb.o",
  16. "wrap_memcpy.o"]
  17. create_makefile("google/protobuf_c")