1#!/usr/bin/ruby 2 3require 'mkmf' 4 5ext_name = "google/protobuf_c" 6 7dir_config(ext_name) 8 9if RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/ || RUBY_PLATFORM =~ /freebsd/ 10 $CFLAGS += " -std=gnu99 -O3 -DNDEBUG -fvisibility=hidden -Wall -Wsign-compare -Wno-declaration-after-statement" 11else 12 $CFLAGS += " -std=gnu99 -O3 -DNDEBUG" 13end 14 15if RUBY_PLATFORM =~ /linux/ 16 # Instruct the linker to point memcpy calls at our __wrap_memcpy wrapper. 17 $LDFLAGS += " -Wl,-wrap,memcpy" 18end 19 20$VPATH << "$(srcdir)/third_party/utf8_range" 21$INCFLAGS += " -I$(srcdir)/third_party/utf8_range" 22 23$srcs = ["protobuf.c", "convert.c", "defs.c", "message.c", 24 "repeated_field.c", "map.c", "ruby-upb.c", "wrap_memcpy.c", 25 "utf8_range.c", "shared_convert.c", 26 "shared_message.c"] 27 28create_makefile(ext_name) 29