Skip to content

Commit

Permalink
Merge pull request #79 from ibmsoe/AIX-fixes
Browse files Browse the repository at this point in the history
AIX Fixes
  • Loading branch information
xerial committed Jul 13, 2014
2 parents 2289820 + e487f82 commit d75f608
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 3 deletions.
18 changes: 16 additions & 2 deletions Makefile.common
Expand Up @@ -42,20 +42,22 @@ endif

# os=Default is meant to be generic unix/linux

known_os_archs := Linux-x86 Linux-x86_64 Linux-arm Linux-armhf Linux-ppc64 Mac-x86 Mac-x86_64 FreeBSD-x86_64 Windows-x86 Windows-x86_64 SunOS-x86 SunOS-sparc SunOS-x86_64
known_os_archs := Linux-x86 Linux-x86_64 Linux-arm Linux-armhf Linux-ppc64 Mac-x86 Mac-x86_64 FreeBSD-x86_64 Windows-x86 Windows-x86_64 SunOS-x86 SunOS-sparc SunOS-x86_64 AIX-ppc64
os_arch := $(OS_NAME)-$(OS_ARCH)
IBM_JDK_7 := $(findstring IBM, $(shell $(JAVA) -version 2>&1 | grep IBM | grep "JRE 1.7"))

ifeq (,$(findstring $(strip $(os_arch)),$(known_os_archs)))
os_arch := Default
endif

os_folder := $(shell echo $(OS_NAME) | tr A-Z a-z)

ifneq ($(IBM_JDK_7),)
$(shell mkdir -p $(IBM_JDK_LIB))
$(shell cp $(JAVA_HOME)/include/jniport.h $(IBM_JDK_LIB))
$(shell sed -i "s|#define JNIEXPORT *$$|#define JNIEXPORT __attribute__((__visibility__(\"default\")))|" $(IBM_JDK_LIB)/jniport.h)
$(shell sed -i "s|typedef long long jlong;.*|/*typedef long long jlong;*/|" $(IBM_JDK_LIB)/jniport.h)
$(shell cp $(JAVA_HOME)/include/linux/jni_md.h $(IBM_JDK_LIB))
$(shell cp $(JAVA_HOME)/include/$(os_folder)/jni_md.h $(IBM_JDK_LIB))
$(shell sed -i "s|#define JNIEXPORT|#define JNIEXPORT __attribute__((__visibility__(\"default\")))|" $(IBM_JDK_LIB)/jni_md.h)
$(shell sed -i "s|typedef long long jlong;.*|/*typedef long long jlong;*/|" $(IBM_JDK_LIB)/jni_md.h)
endif
Expand Down Expand Up @@ -103,6 +105,17 @@ Linux-ppc64_LINKFLAGS := -shared -static-libgcc -static-libstdc++
Linux-ppc64_LIBNAME := libsnappyjava.so
Linux-ppc64_SNAPPY_FLAGS :=

AIX-ppc64_CXX := g++
AIX-ppc64_STRIP := strip -X64
AIX-ppc64_LIBNAME := libsnappyjava.a
ifeq ($(IBM_JDK_7),)
AIX-ppc64_CXXFLAGS := -DHAVE_CONFIG_H -Ilib/inc_linux -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden -m64
else
AIX-ppc64_CXXFLAGS := -DHAVE_CONFIG_H -I$(JAVA_HOME)/include/aix -Ilib/inc_ibm -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -maix64
endif
AIX-ppc64_LINKFLAGS := -shared -static-libgcc -static-libstdc++ -lcrypt
AIX-ppc64_SNAPPY_FLAGS :=

SunOS-x86_CXX := g++
SunOS-x86_STRIP := strip
SunOS-x86_CXXFLAGS := -include lib/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden
Expand Down Expand Up @@ -193,3 +206,4 @@ ifneq ($(jni_include),)
CXXFLAGS := $(CXXFLAGS) -I"$(jni_include)"
endif


1 change: 1 addition & 0 deletions build.sbt
Expand Up @@ -91,6 +91,7 @@ OsgiKeys.additionalHeaders := Map(
"org/xerial/snappy/native/Linux/arm/libsnappyjava.so;osname=linux;processor=arm",
"org/xerial/snappy/native/Linux/ppc64/libsnappyjava.so;osname=linux;processor=ppc64",
"org/xerial/snappy/native/Linux/ppc64le/libsnappyjava.so;osname=linux;processor=ppc64le",
"org/xerial/snappy/native/AIX/ppc64/libsnappyjava.a;osname=aix;processor=ppc64",
"org/xerial/snappy/native/SunOS/x86/libsnappyjava.so;osname=sunos;processor=x86",
"org/xerial/snappy/native/SunOS/x86_64/libsnappyjava.so;osname=sunos;processor=x86-64",
"org/xerial/snappy/native/SunOS/sparc/libsnappyjava.so;osname=sunos;processor=sparc"
Expand Down
53 changes: 53 additions & 0 deletions lib/inc_ibm/jni_md.h
@@ -0,0 +1,53 @@
/*===========================================================================
* Licensed Materials - Property of IBM
* "Restricted Materials of IBM"
*
* IBM SDK, Java(tm) Technology Edition, v7
* (C) Copyright IBM Corp. 2014, 2014. All Rights Reserved
*
* US Government Users Restricted Rights - Use, duplication or disclosure
* restricted by GSA ADP Schedule Contract with IBM Corp.
*===========================================================================
*/
/*
* Copyright (c) 1996, 2000, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/

#ifndef _JAVASOFT_JNI_MD_H_
#define _JAVASOFT_JNI_MD_H_

#define JNIEXPORT __attribute__((__visibility__("default")))
#define JNIIMPORT
#define JNICALL

typedef int jint;
#ifdef _LP64 /* 64-bit Solaris */
typedef long jlong;
#else
/*typedef long long jlong;*/
#endif

typedef signed char jbyte;

#endif /* !_JAVASOFT_JNI_MD_H_ */
56 changes: 56 additions & 0 deletions lib/inc_ibm/jniport.h
@@ -0,0 +1,56 @@
/*******************************************************************************
* Licensed Materials - Property of IBM
* "Restricted Materials of IBM"
*
* (c) Copyright IBM Corp. 1991, 2014 All Rights Reserved
*
* US Government Users Restricted Rights - Use, duplication or disclosure
* restricted by GSA ADP Schedule Contract with IBM Corp.
*******************************************************************************/

#ifndef jniport_h
#define jniport_h

#if defined(WIN32) || defined(_WIN32) || defined(RIM386) || (defined(BREW) && defined(AEE_SIMULATOR))

#define JNIEXPORT __declspec(dllexport)
#define JNICALL __stdcall
typedef signed char jbyte;
typedef int jint;
typedef __int64 jlong;

#else

#define JNIEXPORT __attribute__((__visibility__("default")))

typedef signed char jbyte;
/*typedef long long jlong;*/

#ifdef BREW
#include "AEEFile.h"
#define FILE IFile
#endif

typedef int jint;

#endif /* WIN32 */

#ifndef JNICALL
#define JNICALL
#endif

#ifndef JNIEXPORT
#define JNIEXPORT __attribute__((__visibility__("default")))
#endif

#ifndef JNIIMPORT
#define JNIIMPORT
#endif

#ifdef _JNI_IMPLEMENTATION_
#define _JNI_IMPORT_OR_EXPORT_ JNIEXPORT
#else
#define _JNI_IMPORT_OR_EXPORT_ JNIIMPORT
#endif

#endif /* jniport_h */
12 changes: 11 additions & 1 deletion src/main/java/org/xerial/snappy/OSInfo.java
Expand Up @@ -43,6 +43,7 @@ public class OSInfo
public static final String IA64_32 = "ia64_32";
public static final String IA64 = "ia64";
public static final String PPC = "ppc";
public static final String PPC64 = "ppc64";

static {
// x86 mappings
Expand Down Expand Up @@ -75,6 +76,11 @@ public class OSInfo
archMapping.put("power_rs", PPC);

// TODO: PowerPC 64bit mappings
archMapping.put(PPC64, PPC64);
archMapping.put("power64", PPC64);
archMapping.put("powerpc64", PPC64);
archMapping.put("power_pc64", PPC64);
archMapping.put("power_rs64", PPC64);
}


Expand Down Expand Up @@ -140,7 +146,11 @@ else if (osName.contains("Mac")) {
else if (osName.contains("Linux")) {
return "Linux";
}
else {
else if (osName.contains("AIX")) {
return "AIX";
}

else {
return osName.replaceAll("\\W", "");
}
}
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit d75f608

Please sign in to comment.