Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support GNU/kFreeBSD #113

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@
<condition property="os.prefix" value="freebsd-${os.arch}">
<os name="FreeBSD"/>
</condition>
<condition property="os.prefix" value="kfreebsd-${jre.arch}">
<os name="GNU/kFreeBSD"/>
</condition>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this target binary-compatible with the other targets that generate linux-XXX binaries? It's not strictly an issue with this patch, since this patch enables builds but does not bundle the resulting binaries, but it could lead to some confusion.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is copied from how Debian has been building for GNU/kFreeBSD for the last year or so. I'm not really sure what the implications are of using a different string here - can we just change it to kfreebsd (both here and in native/Makefile)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I had more of a look. I think I'd need to add the right compilation flags in native/Makefile too, but should be able to mostly copy the linux ones. I'll have a go with that tomorrow.

<condition property="os.prefix" value="openbsd-${os.arch}">
<os name="OpenBSD"/>
</condition>
Expand Down Expand Up @@ -416,6 +419,44 @@ osname=macos
</jar>
</target>

<!--
Build a jar with no native libraries.
Used in the Debian/Ubuntu build, as the native library ships separately.
-->
<target name="nonativejar" depends="-setup,native,:jar" unless="-jar"
description="Build primary jar without native libraries">
<jar jarfile="${build}/${jar}" duplicate="preserve">
<manifest>
<attribute name="Main-Class" value="com.sun.jna.Native"/>
<attribute name="Manifest-Version" value="1.0"/>
<attribute name="Implementation-Title" value="${impl.title}"/>
<attribute name="Implementation-Vendor" value="${vendor}"/>
<attribute name="Implementation-Version" value="${impl.version}"/>
<attribute name="Specification-Title" value="${spec.title}"/>
<attribute name="Specification-Vendor" value="${spec.vendor}"/>
<attribute name="Specification-Version" value="${spec.version}"/>
<!--
OSGi Bundle attributes
See http://www.osgi.org/Specifications/Reference
-->
<attribute name="Bundle-Category" value="jni"/>
<attribute name="Bundle-ManifestVersion" value="2"/>
<attribute name="Bundle-Name" value="jna"/>
<attribute name="Bundle-Description" value="JNA Library"/>
<attribute name="Bundle-SymbolicName" value="com.sun.jna"/>
<attribute name="Bundle-Version" value="${spec.version}"/>
<attribute name="Bundle-RequiredExecutionEnvironment" value="J2SE-1.4"/>
<attribute name="Bundle-Vendor" value="${vendor}"/>
<attribute name="Bundle-ActivationPolicy" value="lazy"/>
<attribute name="Export-Package" value="com.sun.jna,com.sun.jna.ptr,com.sun.jna.win32"/>
</manifest>
<fileset dir="${classes}" excludes="${jar.omitted}">
<patternset refid="jar-compiled"/>
<exclude name="**/*jnidispatch*"/>
</fileset>
</jar>
</target>

<target name="platform-jar" depends="jar">
<subant target="jar" failonerror="true">
<property name="file.reference.jna.build" location="${build}"/>
Expand Down Expand Up @@ -500,6 +541,8 @@ osname=macos
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/linux-ia64.jar" overwrite="true"/>
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/linux-ppc.jar" overwrite="true"/>
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/linux-ppc64.jar" overwrite="true"/>
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/kfreebsd-i386.jar" overwrite="true"/>
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/kfreebsd-amd64.jar" overwrite="true"/>
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/freebsd-i386.jar" overwrite="true"/>
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/freebsd-amd64.jar" overwrite="true"/>
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/openbsd-i386.jar" overwrite="true"/>
Expand Down
6 changes: 6 additions & 0 deletions native/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ OS=$(shell uname | sed -e 's/CYGWIN.*/win32/g' \
-e 's/MINGW32.*/win32/g' \
-e 's/SunOS.*/solaris/g' \
-e 's/NetBSD/netbsd/g' \
-e 's/GNU\/kFreeBSD/kfreebsd/g' \
-e 's/FreeBSD/freebsd/g' \
-e 's/OpenBSD/openbsd/g' \
-e 's/Darwin.*/darwin/g' \
Expand Down Expand Up @@ -214,10 +215,15 @@ endif
ifneq (,$(findstring bsd,$(OS)))
ARCH=$(shell uname -m | sed 's/i.86/i386/g')
PCFLAGS+=-fPIC
ifeq ($(OS),kfreebsd)
CDEFINES+=-DHAVE_PROTECTION
LDFLAGS+=-Wl,-soname,$@
else
CINCLUDES+=-I/usr/X11R6/include
LDFLAGS=-o $@ -shared
CDEFINES+=-DHAVE_PROTECTION -DFFI_MMAP_EXEC_WRIT
endif
endif

ifeq ($(OS),solaris)
ifeq ($(ARCH),)
Expand Down