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