Skip to content

Commit

Permalink
enable aarch64 and x86_64 build
Browse files Browse the repository at this point in the history
  • Loading branch information
madeye committed Nov 19, 2014
1 parent 486288a commit a3519fb
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 26 deletions.
14 changes: 7 additions & 7 deletions src/main/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,13 @@ openssl_subdirs := $(addprefix $(LOCAL_PATH)/openssl/,$(addsuffix /Android.mk, \
include $(openssl_subdirs)

# Iptables
LOCAL_PATH := $(ROOT_PATH)
iptables_subdirs := $(addprefix $(LOCAL_PATH)/iptables/,$(addsuffix /Android.mk, \
iptables \
extensions \
libiptc \
))
include $(iptables_subdirs)
# LOCAL_PATH := $(ROOT_PATH)
# iptables_subdirs := $(addprefix $(LOCAL_PATH)/iptables/,$(addsuffix /Android.mk, \
# iptables \
# extensions \
# libiptc \
# ))
# include $(iptables_subdirs)

# Import cpufeatures
$(call import-module,android/cpufeatures)
2 changes: 1 addition & 1 deletion src/main/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
APP_ABI := armeabi-v7a x86
APP_ABI := armeabi-v7a arm64-v8a x86 x86_64
APP_PLATFORM := android-16
APP_STL := stlport_static
NDK_TOOLCHAIN_VERSION := 4.9
2 changes: 2 additions & 0 deletions src/main/jni/libevent/arc4random.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ arc4random(void)
}
#endif

#ifndef _EVENT_HAVE_ARC4RANDOM_BUF
ARC4RANDOM_EXPORT void
arc4random_buf(void *_buf, size_t n)
{
Expand All @@ -490,6 +491,7 @@ arc4random_buf(void *_buf, size_t n)
}
_ARC4_UNLOCK();
}
#endif

#ifndef ARC4RANDOM_NOUNIFORM
/*
Expand Down
17 changes: 15 additions & 2 deletions src/main/jni/libevent/epoll_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,20 @@
#include <sys/syscall.h>
#include <sys/epoll.h>
#include <unistd.h>
#include <errno.h>

int
epoll_create(int size)
{
return (syscall(__NR_epoll_create, size));
#if !defined(__NR_epoll_create) && defined(__NR_epoll_create1)
if (size <= 0) {
errno = EINVAL;
return -1;
}
return (syscall(__NR_epoll_create1, 0));
#else
return (syscall(__NR_epoll_create, size));
#endif
}

int
Expand All @@ -48,5 +57,9 @@ epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
int
epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout)
{
return (syscall(__NR_epoll_wait, epfd, events, maxevents, timeout));
#if !defined(__NR_epoll_wait) && defined(__NR_epoll_pwait)
return (syscall(__NR_epoll_pwait, epfd, events, maxevents, timeout, NULL, 0));
#else
return (syscall(__NR_epoll_wait, epfd, events, maxevents, timeout));
#endif
}
8 changes: 5 additions & 3 deletions src/main/jni/libevent/include/event2/event-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
/* #undef _EVENT_DISABLE_THREAD_SUPPORT */

/* Define to 1 if you have the `arc4random' function. */
#if !defined(__aarch64__) && !defined(__x86_64__)
#define _EVENT_HAVE_ARC4RANDOM 1
#endif

/* Define to 1 if you have the `arc4random_buf' function. */
/* #undef _EVENT_HAVE_ARC4RANDOM_BUF */
#define _EVENT_HAVE_ARC4RANDOM_BUF

/* Define to 1 if you have the <arpa/inet.h> header file. */
#define _EVENT_HAVE_ARPA_INET_H 1
Expand Down Expand Up @@ -262,7 +264,7 @@
/* #undef _EVENT_HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */

/* Define to 1 if you have the `sysctl' function. */
#define _EVENT_HAVE_SYSCTL 1
// #define _EVENT_HAVE_SYSCTL 1

/* Define to 1 if you have the <sys/devpoll.h> header file. */
/* #undef _EVENT_HAVE_SYS_DEVPOLL_H */
Expand Down Expand Up @@ -301,7 +303,7 @@
#define _EVENT_HAVE_SYS_STAT_H 1

/* Define to 1 if you have the <sys/sysctl.h> header file. */
#define _EVENT_HAVE_SYS_SYSCTL_H 1
//#define _EVENT_HAVE_SYS_SYSCTL_H 1

/* Define to 1 if you have the <sys/time.h> header file. */
#define _EVENT_HAVE_SYS_TIME_H 1
Expand Down
2 changes: 1 addition & 1 deletion src/main/jni/openssl/android-config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ LOCAL_CFLAGS += -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_SCTP \
# LOCAL_CFLAGS += -DOPENSSL_NO_DEPRECATED

# Extra
LOCAL_CFLAGS += -DOPENSSL_NO_HW -DOPENSSL_NO_ENGINE -DZLIB
LOCAL_CFLAGS += -DOPENSSL_NO_HW -DOPENSSL_NO_ASM -DOPENSSL_NO_ENGINE -DZLIB

# Debug
# LOCAL_CFLAGS += -DCIPHER_DEBUG
8 changes: 6 additions & 2 deletions src/main/jni/pdnsd/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@
#define HAVE_FCNTL_H 1

/* Define to 1 if you have the `getline' function. */
//#define HAVE_GETLINE 1
#if defined(__aarch64__) || defined(__x86_64__)
#define HAVE_GETLINE 1
#endif

/* Define to 1 if you have the `getpwnam_r' function. */
//#define HAVE_GETPWNAM_R 1
Expand Down Expand Up @@ -282,7 +284,9 @@
#define HAVE_STDLIB_H 1

/* Define to 1 if you have the `stpcpy' function. */
//#define HAVE_STPCPY 1
#if defined(__aarch64__) || defined(__x86_64__)
#define HAVE_STPCPY 1
#endif

/* Define to 1 if you have the `stpncpy' function. */
//#define HAVE_STPNCPY 1
Expand Down
2 changes: 2 additions & 0 deletions src/main/jni/pdnsd/src/ipvers.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ __cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) __THROW

/* This is the IPv6 flowid that we pass on to the IPv6 protocol stack. This value was not currently defined
* at the time of writing. Should this change, define a appropriate flowinfo here. */
#ifndef IPV6_FLOWINFO
#define IPV6_FLOWINFO 0
#endif

/* There does not seem to be a function/macro to generate IPv6-mapped IPv4-Adresses. So here comes mine.
* Pass an in_addr* and an in6_addr* */
Expand Down
8 changes: 0 additions & 8 deletions src/main/scala/com/github/shadowsocks/Shadowsocks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -830,14 +830,6 @@ class Shadowsocks

crash_recovery()

copyAssets(System.getABI)

val ab = new ArrayBuffer[String]
for (executable <- Shadowsocks.EXECUTABLES) {
ab.append("chmod 755 " + Path.BASE + executable)
}
Console.runCommand(ab.toArray)

}

private def recovery() {
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/com/github/shadowsocks/utils/Utils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ object Utils {
val DEFAULT_SHELL: String = "/system/bin/sh"
val DEFAULT_ROOT: String = "/system/bin/su"
val ALTERNATIVE_ROOT: String = "/system/xbin/su"
val DEFAULT_IPTABLES: String = "/data/data/com.github.shadowsocks/iptables"
val ALTERNATIVE_IPTABLES: String = "/system/bin/iptables"
val DEFAULT_IPTABLES: String = "/system/bin/iptables"
val ALTERNATIVE_IPTABLES: String = "/data/data/com.github.shadowsocks/iptables"
val TIME_OUT: Int = -99
var initialized: Boolean = false
var hasRedirectSupport: Int = -1
Expand Down

0 comments on commit a3519fb

Please sign in to comment.