61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
# File 'ext/libyajl2/extconf.rb', line 61
def self.makemakefiles
if RUBY_PLATFORM == "java"
File.open("Makefile", "w+") do |f|
f.write <<EOF
CC = gcc
TARGET = libyajl
DLLIB = $(TARGET).so
CFLAGS = -I. -I../../../../ext/libyajl2 -fPIC -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC -std=c99 -pedantic -Wpointer-arith -Wno-format-y2k -Wstrict-prototypes -Wmissing-declarations -Wnested-externs -Wextra -Wundef -Wwrite-strings -Wold-style-definition -Wredundant-decls -Wno-unused-parameter -Wno-sign-compare -Wmissing-prototypes -O2 -DNDEBUG
LDFLAGS = -L. -fstack-protector -rdynamic
#LIBS = -lpthread -ldl -lcrypt -lm -lc
LIBS = -lpthread -ldl -lm -lc
OBJS = yajl_alloc.o yajl_tree.o yajl_gen.o yajl_buf.o yajl.o yajl_encode.o yajl_lex.o yajl_parser.o yajl_version.o
all: $(DLLIB)
$(DLLIB): $(OBJS)
\t$(CC) -shared -o $(DLLIB) $(OBJS) $(LDFLAGS) $(LIBS)
%.o: ../../../../ext/libyajl2/%.c
\t$(COMPILE.c) $(OUTPUT_OPTION) $<
install:
\tmkdir -p #{prefix}/lib
\tcp $(DLLIB) #{prefix}/lib/$(DLLIB)
\tmkdir -p #{prefix}/include/yajl
\tcp yajl/*.h #{prefix}/include/yajl
EOF
end
else
deps
setup_env
dir_config("libyajl")
create_makefile("libyajl")
if windows?
makefile = IO.read("Makefile")
makefile.gsub!(/\$\(DEFFILE\)/, "")
File.open("Makefile", "w+") { |f| f.write(makefile) }
end
system("pwd")
system("make >make.out 2>&1") || raise
File.open("Makefile", "w+") do |f|
f.write <<EOF
TARGET = libyajl
DLLIB = $(TARGET).#{RbConfig::MAKEFILE_CONFIG['DLEXT']}
all:
EOF
if windows?
f.write <<EOF
install:
\tmkdir -p #{prefix}/lib
\tcp libyajl.so #{prefix}/lib/libyajl.so
\tcp libyajldll.a #{prefix}/lib/libyajldll.a
\tcp libyajl.def #{prefix}/lib/libyajl.def
\tmkdir -p #{prefix}/include/yajl
\tcp yajl/*.h #{prefix}/include/yajl
EOF
else
f.write <<EOF
install:
\tmkdir -p #{prefix}/lib
\tcp $(DLLIB) #{prefix}/lib/$(DLLIB)
\tmkdir -p #{prefix}/include/yajl
\tcp yajl/*.h #{prefix}/include/yajl
EOF
end
end
end
end
|