Gentoo Archives: gentoo-commits

From: Alex Legler <a3li@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/ruby-overlay:master commit in: dev-java/jffi/files/, dev-java/jffi/
Date: Tue, 27 Sep 2011 17:45:09
Message-Id: fa72a50859380c2c6de447bdd9afc170790e079e.a3li@gentoo
1 commit: fa72a50859380c2c6de447bdd9afc170790e079e
2 Author: Alex Legler <alex <AT> a3li <DOT> li>
3 AuthorDate: Tue Sep 27 17:42:39 2011 +0000
4 Commit: Alex Legler <a3li <AT> gentoo <DOT> org>
5 CommitDate: Tue Sep 27 17:42:39 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/ruby-overlay.git;a=commit;h=fa72a508
7
8 Add jffi ebuild
9
10 ---
11 dev-java/jffi/files/1.0.0-gcc-3.4.patch | 14 ++++
12 dev-java/jffi/files/jffi-1.0.0-makefile.patch | 82 ++++++++++++++++++++++++
13 dev-java/jffi/files/jffi-1.0.10-makefile.patch | 11 +++
14 dev-java/jffi/jffi-1.0.10.ebuild | 81 +++++++++++++++++++++++
15 dev-java/jffi/metadata.xml | 6 ++
16 5 files changed, 194 insertions(+), 0 deletions(-)
17
18 diff --git a/dev-java/jffi/files/1.0.0-gcc-3.4.patch b/dev-java/jffi/files/1.0.0-gcc-3.4.patch
19 new file mode 100644
20 index 0000000..fc2bd5c
21 --- /dev/null
22 +++ b/dev-java/jffi/files/1.0.0-gcc-3.4.patch
23 @@ -0,0 +1,14 @@
24 +diff --git a/jni/GNUmakefile b/jni/GNUmakefile
25 +index 7a027af..eaba319 100755
26 +--- a/jni/GNUmakefile
27 ++++ b/jni/GNUmakefile
28 +@@ -188,9 +188,6 @@ endif
29 +
30 + ifeq ($(CPU), i386)
31 + MODEL = 32
32 +- ifeq ($(findstring $(OS), openbsd darwin mingw32 win32),)
33 +- CFLAGS += -march=i586 -mtune=generic
34 +- endif
35 + endif
36 +
37 + ifeq ($(CPU), amd64)
38
39 diff --git a/dev-java/jffi/files/jffi-1.0.0-makefile.patch b/dev-java/jffi/files/jffi-1.0.0-makefile.patch
40 new file mode 100644
41 index 0000000..11ca2ed
42 --- /dev/null
43 +++ b/dev-java/jffi/files/jffi-1.0.0-makefile.patch
44 @@ -0,0 +1,82 @@
45 +--- jni/GNUmakefile 2010-03-12 12:06:39.000000000 +1300
46 ++++ jni/GNUmakefile 2010-03-12 12:13:44.000000000 +1300
47 +@@ -65,7 +65,7 @@
48 +
49 + # MacOS headers aren't completely warning free, so turn them off
50 + ifneq ($(OS),darwin)
51 +- WFLAGS = -W -Werror -Wall -Wno-unused -Wno-parentheses -Wundef
52 ++ WFLAGS = -W -Wall -Wno-unused -Wno-parentheses -Wundef
53 + endif
54 + PICFLAGS = -fPIC
55 + SOFLAGS = # Filled in for each OS specifically
56 +@@ -78,9 +78,9 @@
57 +
58 + JDK_INCLUDES = -I"$(JDK_HOME)/include" -I"$(JDK_HOME)/include/$(OS)"
59 + IFLAGS = -I"$(BUILD_DIR)" -I"$(BUILD_DIR)"/jni -I$(SRC_DIR) -I"$(JFFI_SRC_DIR)"
60 +-CFLAGS = $(OFLAGS) $(WFLAGS) $(IFLAGS) $(PICFLAGS) $(JDK_INCLUDES) $(LIBFFI_CFLAGS)
61 ++CFLAGS += $(OFLAGS) $(WFLAGS) $(IFLAGS) $(PICFLAGS) $(JDK_INCLUDES) $(LIBFFI_CFLAGS)
62 + CFLAGS += -D_REENTRANT -D_LARGEFILE64_SOURCE -D_GNU_SOURCE
63 +-CXXFLAGS = $(OFLAGS) $(IFLAGS) $(PICFLAGS) $(JDK_INCLUDES) $(LIBFFI_CFLAGS)
64 ++CXXFLAGS += $(OFLAGS) $(IFLAGS) $(PICFLAGS) $(JDK_INCLUDES) $(LIBFFI_CFLAGS)
65 +
66 + ifeq ($(OS), win64)
67 + override CPU = x86_64
68 +@@ -258,58 +258,6 @@
69 + @mkdir -p $(@D)
70 + $(CCACHE) $(CXX) $(CXXFLAGS) -c $< -o $@
71 +
72 +-
73 +-ifeq ($(OS), darwin)
74 +-build_ffi = \
75 +- mkdir -p $(BUILD_DIR)/libffi-darwin-$(1); \
76 +- (if [ ! -f $(BUILD_DIR)/libffi-darwin-$(1)/Makefile ]; then \
77 +- echo "Configuring libffi for $(1)"; \
78 +- cd $(BUILD_DIR)/libffi-darwin-$(1) && \
79 +- env CC="$(CCACHE) $(CC)" CFLAGS="-arch $(1) $(FFI_CFLAGS)" LDFLAGS="-arch $(1)" \
80 +- $(LIBFFI_CONFIGURE) --host=$(1)-apple-darwin > /dev/null; \
81 +- fi); \
82 +- env MACOSX_DEPLOYMENT_TARGET=10.5 $(MAKE) -C $(BUILD_DIR)/libffi-darwin-$(1)
83 +-
84 +-$(LIBFFI):
85 +- @mkdir -p $(@D)
86 +- @for arch in $(ARCHES); do $(call build_ffi,$$arch);done
87 +-
88 +- # Assemble into a FAT (i386, x86_64, ppc) library
89 +- @mkdir -p $(BUILD_DIR)/libffi/.libs
90 +- @env MACOSX_DEPLOYMENT_TARGET=10.5 /usr/bin/libtool -static -o $@ \
91 +- $(foreach arch, $(ARCHES),$(BUILD_DIR)/libffi-darwin-$(arch)/.libs/libffi_convenience.a)
92 +- @mkdir -p $(LIBFFI_BUILD_DIR)/include
93 +- $(RM) $(LIBFFI_BUILD_DIR)/include/ffi.h
94 +- @( \
95 +- printf "#if defined(__i386__)\n"; \
96 +- printf "#include \"libffi-darwin-i386/include/ffi.h\"\n"; \
97 +- printf "#elif defined(__x86_64__)\n"; \
98 +- printf "#include \"libffi-darwin-x86_64/include/ffi.h\"\n";\
99 +- printf "#elif defined(__ppc__)\n"; \
100 +- printf "#include \"libffi-darwin-ppc/include/ffi.h\"\n";\
101 +- printf "#endif\n";\
102 +- ) > $(LIBFFI_BUILD_DIR)/include/ffi.h
103 +- @( \
104 +- printf "#if defined(__i386__)\n"; \
105 +- printf "#include \"libffi-darwin-i386/include/ffitarget.h\"\n"; \
106 +- printf "#elif defined(__x86_64__)\n"; \
107 +- printf "#include \"libffi-darwin-x86_64/include/ffitarget.h\"\n";\
108 +- printf "#elif defined(__ppc__)\n"; \
109 +- printf "#include \"libffi-darwin-ppc/include/ffitarget.h\"\n";\
110 +- printf "#endif\n";\
111 +- ) > $(LIBFFI_BUILD_DIR)/include/ffitarget.h
112 +-else
113 +-$(LIBFFI):
114 +- @mkdir -p $(LIBFFI_BUILD_DIR)
115 +- @if [ ! -f $(LIBFFI_BUILD_DIR)/Makefile ]; then \
116 +- echo "Configuring libffi for $(PLATFORM)"; \
117 +- cd $(LIBFFI_BUILD_DIR) && env CC="$(FFI_CC)" LD="$(FFI_LD)" CFLAGS="$(FFI_CFLAGS)" \
118 +- $(LIBFFI_CONFIGURE) > /dev/null; \
119 +- fi
120 +- $(MAKE) -C $(LIBFFI_BUILD_DIR)
121 +-endif
122 +-
123 +-
124 + clean::
125 + # nothing to do - ant will delete the build dir
126 +
127
128 diff --git a/dev-java/jffi/files/jffi-1.0.10-makefile.patch b/dev-java/jffi/files/jffi-1.0.10-makefile.patch
129 new file mode 100644
130 index 0000000..54254ff
131 --- /dev/null
132 +++ b/dev-java/jffi/files/jffi-1.0.10-makefile.patch
133 @@ -0,0 +1,11 @@
134 +--- jni/GNUmakefile.orig 2011-09-20 12:01:49.744714806 +0200
135 ++++ jni/GNUmakefile 2011-09-20 12:02:56.270712427 +0200
136 +@@ -64,7 +64,7 @@
137 + OFLAGS = -O2 $(JFLAGS)
138 +
139 + # MacOS headers aren't completely warning free, so turn them off
140 +-WERROR = -Werror
141 ++WERROR =
142 + ifneq ($(OS),darwin)
143 + WFLAGS += -Wundef $(WERROR)
144 + endif
145
146 diff --git a/dev-java/jffi/jffi-1.0.10.ebuild b/dev-java/jffi/jffi-1.0.10.ebuild
147 new file mode 100644
148 index 0000000..28e6386
149 --- /dev/null
150 +++ b/dev-java/jffi/jffi-1.0.10.ebuild
151 @@ -0,0 +1,81 @@
152 +# Copyright 1999-2010 Gentoo Foundation
153 +# Distributed under the terms of the GNU General Public License v2
154 +# $Header: /var/cvsroot/gentoo-x86/dev-java/jffi/jffi-1.0.0.ebuild,v 1.6 2010/05/24 19:02:03 pacho Exp $
155 +
156 +# Probably best to leave the CFLAGS as they are here. See...
157 +# http://weblogs.java.net/blog/kellyohair/archive/2006/01/compilation_of_1.html
158 +
159 +EAPI="2"
160 +JAVA_PKG_IUSE="source test"
161 +WANT_ANT_TASKS="ant-nodeps"
162 +inherit java-pkg-2 java-ant-2 toolchain-funcs flag-o-matic versionator
163 +
164 +DESCRIPTION="An optimized Java interface to libffi"
165 +HOMEPAGE="http://github.com/wmeissner/jffi"
166 +
167 +SRC_URI="https://github.com/wmeissner/jffi/tarball/${PV} -> ${P}.tar.gz"
168 +
169 +LICENSE="LGPL-3"
170 +SLOT="0.4"
171 +KEYWORDS="amd64 ppc x86"
172 +IUSE=""
173 +
174 +RDEPEND=">=virtual/jre-1.5
175 + virtual/libffi"
176 +
177 +DEPEND=">=virtual/jdk-1.5
178 + virtual/libffi
179 + dev-util/pkgconfig
180 + test? ( dev-java/ant-junit4 )"
181 +
182 +JAVA_PKG_BSFIX_NAME="build-impl.xml custom-build.xml"
183 +JAVA_PKG_FILTER_COMPILER="ecj-3.3 ecj-3.4 ecj-3.5"
184 +
185 +src_unpack() {
186 + unpack ${A}
187 + mv wmeissner* "${P}" || die
188 +}
189 +
190 +java_prepare() {
191 + # Delete the bundled JARs.
192 + find lib archive -name "*.jar" -delete || die
193 + # Delete the bundled libffi
194 + rm -rf jni/libffi || die
195 +
196 + epatch "${FILESDIR}/${P}-makefile.patch"
197 +# epatch "${FILESDIR}/1.0.0-gcc-3.4.patch"
198 +
199 + # any better function for this, excluding get_system_arch in java-vm-2 which is incorrect to inherit ?
200 + local arch=""
201 + use x86 && arch="i386"
202 + use amd64 && arch="x86_64"
203 + use ppc && arch="ppc"
204 +
205 + # Don't include prebuilt files for other archs.
206 + sed -i '/<zipfileset src="archive\//d' custom-build.xml || die
207 + sed -i '/libs.CopyLibs.classpath/d' lib/nblibraries.properties || die
208 + sed -i '/copylibstask.jar/d' lib/nblibraries.properties || die
209 +}
210 +
211 +EANT_EXTRA_ARGS="-Duse.system.libffi=1"
212 +
213 +src_install() {
214 + mkdir -p "${T}"/com/kenai/jffi
215 + cat - > "${T}"/com/kenai/jffi/boot.properties <<EOF
216 +jffi.boot.library.path = ${JAVA_PKG_LIBDEST}
217 +EOF
218 +
219 + pushd "${T}" &>/dev/null
220 + jar -uf "${S}"/dist/${PN}.jar com
221 + popd
222 +
223 + java-pkg_dojar dist/${PN}.jar
224 + java-pkg_doso build/jni/lib${PN}-$(get_version_component_range 1-2).so
225 + use source && java-pkg_dosrc src/*
226 +}
227 +
228 +src_test() {
229 + ANT_TASKS="ant-junit4 ant-nodeps" eant test \
230 + "${EANT_EXTRA_ARGS}" \
231 + -Dlibs.junit_4.classpath="$(java-pkg_getjars --with-dependencies junit-4)"
232 +}
233
234 diff --git a/dev-java/jffi/metadata.xml b/dev-java/jffi/metadata.xml
235 new file mode 100644
236 index 0000000..604e0a4
237 --- /dev/null
238 +++ b/dev-java/jffi/metadata.xml
239 @@ -0,0 +1,6 @@
240 +<?xml version="1.0" encoding="UTF-8"?>
241 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
242 +<pkgmetadata>
243 + <herd>java</herd>
244 +</pkgmetadata>
245 +