Skip to content

Commit d75f608

Browse files
committed
Merge pull request xerial#79 from ibmsoe/AIX-fixes
AIX Fixes
2 parents 2289820 + e487f82 commit d75f608

File tree

7 files changed

+137
-3
lines changed

7 files changed

+137
-3
lines changed

Makefile.common

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,22 @@ endif
4242

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

45-
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
45+
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
4646
os_arch := $(OS_NAME)-$(OS_ARCH)
4747
IBM_JDK_7 := $(findstring IBM, $(shell $(JAVA) -version 2>&1 | grep IBM | grep "JRE 1.7"))
4848

4949
ifeq (,$(findstring $(strip $(os_arch)),$(known_os_archs)))
5050
os_arch := Default
5151
endif
5252

53+
os_folder := $(shell echo $(OS_NAME) | tr A-Z a-z)
54+
5355
ifneq ($(IBM_JDK_7),)
5456
$(shell mkdir -p $(IBM_JDK_LIB))
5557
$(shell cp $(JAVA_HOME)/include/jniport.h $(IBM_JDK_LIB))
5658
$(shell sed -i "s|#define JNIEXPORT *$$|#define JNIEXPORT __attribute__((__visibility__(\"default\")))|" $(IBM_JDK_LIB)/jniport.h)
5759
$(shell sed -i "s|typedef long long jlong;.*|/*typedef long long jlong;*/|" $(IBM_JDK_LIB)/jniport.h)
58-
$(shell cp $(JAVA_HOME)/include/linux/jni_md.h $(IBM_JDK_LIB))
60+
$(shell cp $(JAVA_HOME)/include/$(os_folder)/jni_md.h $(IBM_JDK_LIB))
5961
$(shell sed -i "s|#define JNIEXPORT|#define JNIEXPORT __attribute__((__visibility__(\"default\")))|" $(IBM_JDK_LIB)/jni_md.h)
6062
$(shell sed -i "s|typedef long long jlong;.*|/*typedef long long jlong;*/|" $(IBM_JDK_LIB)/jni_md.h)
6163
endif
@@ -103,6 +105,17 @@ Linux-ppc64_LINKFLAGS := -shared -static-libgcc -static-libstdc++
103105
Linux-ppc64_LIBNAME := libsnappyjava.so
104106
Linux-ppc64_SNAPPY_FLAGS :=
105107

108+
AIX-ppc64_CXX := g++
109+
AIX-ppc64_STRIP := strip -X64
110+
AIX-ppc64_LIBNAME := libsnappyjava.a
111+
ifeq ($(IBM_JDK_7),)
112+
AIX-ppc64_CXXFLAGS := -DHAVE_CONFIG_H -Ilib/inc_linux -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden -m64
113+
else
114+
AIX-ppc64_CXXFLAGS := -DHAVE_CONFIG_H -I$(JAVA_HOME)/include/aix -Ilib/inc_ibm -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -maix64
115+
endif
116+
AIX-ppc64_LINKFLAGS := -shared -static-libgcc -static-libstdc++ -lcrypt
117+
AIX-ppc64_SNAPPY_FLAGS :=
118+
106119
SunOS-x86_CXX := g++
107120
SunOS-x86_STRIP := strip
108121
SunOS-x86_CXXFLAGS := -include lib/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden
@@ -193,3 +206,4 @@ ifneq ($(jni_include),)
193206
CXXFLAGS := $(CXXFLAGS) -I"$(jni_include)"
194207
endif
195208

209+

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ OsgiKeys.additionalHeaders := Map(
9191
"org/xerial/snappy/native/Linux/arm/libsnappyjava.so;osname=linux;processor=arm",
9292
"org/xerial/snappy/native/Linux/ppc64/libsnappyjava.so;osname=linux;processor=ppc64",
9393
"org/xerial/snappy/native/Linux/ppc64le/libsnappyjava.so;osname=linux;processor=ppc64le",
94+
"org/xerial/snappy/native/AIX/ppc64/libsnappyjava.a;osname=aix;processor=ppc64",
9495
"org/xerial/snappy/native/SunOS/x86/libsnappyjava.so;osname=sunos;processor=x86",
9596
"org/xerial/snappy/native/SunOS/x86_64/libsnappyjava.so;osname=sunos;processor=x86-64",
9697
"org/xerial/snappy/native/SunOS/sparc/libsnappyjava.so;osname=sunos;processor=sparc"

lib/inc_ibm/jni_md.h

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*===========================================================================
2+
* Licensed Materials - Property of IBM
3+
* "Restricted Materials of IBM"
4+
*
5+
* IBM SDK, Java(tm) Technology Edition, v7
6+
* (C) Copyright IBM Corp. 2014, 2014. All Rights Reserved
7+
*
8+
* US Government Users Restricted Rights - Use, duplication or disclosure
9+
* restricted by GSA ADP Schedule Contract with IBM Corp.
10+
*===========================================================================
11+
*/
12+
/*
13+
* Copyright (c) 1996, 2000, Oracle and/or its affiliates. All rights reserved.
14+
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
15+
*
16+
*
17+
*
18+
*
19+
*
20+
*
21+
*
22+
*
23+
*
24+
*
25+
*
26+
*
27+
*
28+
*
29+
*
30+
*
31+
*
32+
*
33+
*
34+
*
35+
*/
36+
37+
#ifndef _JAVASOFT_JNI_MD_H_
38+
#define _JAVASOFT_JNI_MD_H_
39+
40+
#define JNIEXPORT __attribute__((__visibility__("default")))
41+
#define JNIIMPORT
42+
#define JNICALL
43+
44+
typedef int jint;
45+
#ifdef _LP64 /* 64-bit Solaris */
46+
typedef long jlong;
47+
#else
48+
/*typedef long long jlong;*/
49+
#endif
50+
51+
typedef signed char jbyte;
52+
53+
#endif /* !_JAVASOFT_JNI_MD_H_ */

lib/inc_ibm/jniport.h

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*******************************************************************************
2+
* Licensed Materials - Property of IBM
3+
* "Restricted Materials of IBM"
4+
*
5+
* (c) Copyright IBM Corp. 1991, 2014 All Rights Reserved
6+
*
7+
* US Government Users Restricted Rights - Use, duplication or disclosure
8+
* restricted by GSA ADP Schedule Contract with IBM Corp.
9+
*******************************************************************************/
10+
11+
#ifndef jniport_h
12+
#define jniport_h
13+
14+
#if defined(WIN32) || defined(_WIN32) || defined(RIM386) || (defined(BREW) && defined(AEE_SIMULATOR))
15+
16+
#define JNIEXPORT __declspec(dllexport)
17+
#define JNICALL __stdcall
18+
typedef signed char jbyte;
19+
typedef int jint;
20+
typedef __int64 jlong;
21+
22+
#else
23+
24+
#define JNIEXPORT __attribute__((__visibility__("default")))
25+
26+
typedef signed char jbyte;
27+
/*typedef long long jlong;*/
28+
29+
#ifdef BREW
30+
#include "AEEFile.h"
31+
#define FILE IFile
32+
#endif
33+
34+
typedef int jint;
35+
36+
#endif /* WIN32 */
37+
38+
#ifndef JNICALL
39+
#define JNICALL
40+
#endif
41+
42+
#ifndef JNIEXPORT
43+
#define JNIEXPORT __attribute__((__visibility__("default")))
44+
#endif
45+
46+
#ifndef JNIIMPORT
47+
#define JNIIMPORT
48+
#endif
49+
50+
#ifdef _JNI_IMPLEMENTATION_
51+
#define _JNI_IMPORT_OR_EXPORT_ JNIEXPORT
52+
#else
53+
#define _JNI_IMPORT_OR_EXPORT_ JNIIMPORT
54+
#endif
55+
56+
#endif /* jniport_h */

src/main/java/org/xerial/snappy/OSInfo.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public class OSInfo
4343
public static final String IA64_32 = "ia64_32";
4444
public static final String IA64 = "ia64";
4545
public static final String PPC = "ppc";
46+
public static final String PPC64 = "ppc64";
4647

4748
static {
4849
// x86 mappings
@@ -75,6 +76,11 @@ public class OSInfo
7576
archMapping.put("power_rs", PPC);
7677

7778
// TODO: PowerPC 64bit mappings
79+
archMapping.put(PPC64, PPC64);
80+
archMapping.put("power64", PPC64);
81+
archMapping.put("powerpc64", PPC64);
82+
archMapping.put("power_pc64", PPC64);
83+
archMapping.put("power_rs64", PPC64);
7884
}
7985

8086

@@ -140,7 +146,11 @@ else if (osName.contains("Mac")) {
140146
else if (osName.contains("Linux")) {
141147
return "Linux";
142148
}
143-
else {
149+
else if (osName.contains("AIX")) {
150+
return "AIX";
151+
}
152+
153+
else {
144154
return osName.replaceAll("\\W", "");
145155
}
146156
}
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)