Compare commits

...
2 Commits
Author SHA1 Message Date
Max Lv 0647ef4c6d fix #121 2014-09-19 14:17:45 +08:00
Max Lv 97c6ff95cd fix an issue in the build scripts 2014-09-18 08:24:39 +08:00
6 changed files with 74 additions and 45 deletions
+18 -4
View File
@@ -1,14 +1,28 @@
#!/bin/bash #!/bin/bash
ndk-build clean function try () {
ndk-build "$@" || exit -1
}
# Build
try ndk-build clean
try ndk-build
# copy executables
rm -rf src/main/assets/armeabi-v7a rm -rf src/main/assets/armeabi-v7a
rm -rf src/main/assets/x86 rm -rf src/main/assets/x86
mkdir -p src/main/assets/armeabi-v7a mkdir -p src/main/assets/armeabi-v7a
mkdir -p src/main/assets/x86 mkdir -p src/main/assets/x86
for app in pdnsd redsocks for app in pdnsd redsocks
do do
mv libs/armeabi-v7a/$app src/main/assets/armeabi-v7a/ try mv libs/armeabi-v7a/$app src/main/assets/armeabi-v7a/
mv libs/x86/$app src/main/assets/x86/ try mv libs/x86/$app src/main/assets/x86/
done done
# copy libraries
rm -rf src/main/jni/armeabi-v7a
rm -rf src/main/jni/x86
mkdir -p src/main/jni/armeabi-v7a
mkdir -p src/main/jni/x86
try mv libs/armeabi-v7a/*.so src/main/jni/armeabi-v7a/
try mv libs/x86/*.so src/main/jni/x86/
+5 -5
View File
@@ -21,11 +21,11 @@ jstring Java_com_github_shadowsocks_system_getabi(JNIEnv *env, jobject thiz) {
} else if (family == ANDROID_CPU_FAMILY_MIPS) { } else if (family == ANDROID_CPU_FAMILY_MIPS) {
abi = "mips"; abi = "mips";
} else if (family == ANDROID_CPU_FAMILY_ARM) { } else if (family == ANDROID_CPU_FAMILY_ARM) {
if (features & ANDROID_CPU_ARM_FEATURE_ARMv7) { // if (features & ANDROID_CPU_ARM_FEATURE_ARMv7) {
abi = "armeabi-v7a"; abi = "armeabi-v7a";
} else { // } else {
abi = "armeabi"; // abi = "armeabi";
} // }
} }
return env->NewStringUTF(abi); return env->NewStringUTF(abi);
} }
+2 -2
View File
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.shadowsocks" package="com.github.shadowsocks"
android:versionCode="71" android:versionCode="73"
android:versionName="2.2.3"> android:versionName="2.2.5">
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
@@ -114,25 +114,40 @@ class ShadowsocksNatService extends Service with BaseService {
}) })
} }
val raw_args = ("ss-local -b 127.0.0.1 -s %s -p %d -l %d -k %s -m %s -f " + val cmd = new ArrayBuffer[String]
Path.BASE + "ss-local.pid") cmd += ("ss-local"
.format(config.proxy, config.remotePort, config.localPort, config.sitekey, config.encMethod) , "-b" , "127.0.0.1"
val args = if (Build.VERSION.SDK_INT >= 20) { , "-s" , config.proxy
raw_args , "-p" , config.remotePort.toString
} else { , "-l" , config.localPort.toString
Path.BASE + raw_args , "-k" , config.sitekey
} , "-m" , config.encMethod
val cmd = if (config.isGFWList && isACLEnabled) args + " --acl " + Path.BASE + "chn.acl" else args , "-f" , (Path.BASE + "ss-local.pid"))
if (BuildConfig.DEBUG) Log.d(TAG, cmd)
Core.sslocal(cmd.split(" ")) if (config.isGFWList && isACLEnabled) {
cmd += "--acl"
cmd += (Path.BASE + "chn.acl")
}
if (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" "))
Core.sslocal(cmd.toArray)
} }
def startDnsDaemon() { def startDnsDaemon() {
val args = if (config.isUdpDns) { if (config.isUdpDns) {
("ss-tunnel -b 127.0.0.1 -s %s -p %d -l %d -k %s -m %s -L 8.8.8.8:53 -u -f " + val cmd = new ArrayBuffer[String]
Path.BASE + "ss-tunnel.pid") cmd += ("ss-tunnel" , "-u"
.format(config.proxy, config.remotePort, 8153, config.sitekey, config.encMethod) , "-b" , "127.0.0.1"
, "-l" , "8153"
, "-L" , "8.8.8.8:53"
, "-s" , config.proxy
, "-p" , config.remotePort.toString
, "-k" , config.sitekey
, "-m" , config.encMethod
, "-f" , (Path.BASE + "ss-tunnel.pid"))
if (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" "))
Core.sstunnel(cmd.toArray)
} else { } else {
val conf = { val conf = {
if (config.isGFWList) if (config.isGFWList)
@@ -143,20 +158,15 @@ class ShadowsocksNatService extends Service with BaseService {
ConfigUtils.printToFile(new File(Path.BASE + "pdnsd.conf"))(p => { ConfigUtils.printToFile(new File(Path.BASE + "pdnsd.conf"))(p => {
p.println(conf) p.println(conf)
}) })
"pdnsd -c " + Path.BASE + "pdnsd.conf"
}
val cmd = if (Build.VERSION.SDK_INT >= 20) { val args = "pdnsd -c " + Path.BASE + "pdnsd.conf"
"/system/bin/" + args
} else {
Path.BASE + args
}
if (BuildConfig.DEBUG) Log.d(TAG, cmd) val cmd = if (Build.VERSION.SDK_INT >= 20) {
"/system/bin/" + args
if (config.isUdpDns) { } else {
Core.sstunnel(cmd.split(" ")) Path.BASE + args
} else { }
if (BuildConfig.DEBUG) Log.d(TAG, cmd)
Console.runRootCommand(cmd) Console.runRootCommand(cmd)
} }
} }
@@ -80,12 +80,17 @@ class ShadowsocksVpnService extends VpnService with BaseService {
} }
def startShadowsocksDaemon() { def startShadowsocksDaemon() {
val cmd: String = (Path.BASE + val cmd = new ArrayBuffer[String]
"ss-local -b 127.0.0.1 -s %s -p %d -l %d -k %s -m %s -u -f " + cmd += ("ss-local" , "-u"
Path.BASE + "ss-local.pid") , "-b" , "127.0.0.1"
.format(config.proxy, config.remotePort, config.localPort, config.sitekey, config.encMethod) , "-s" , config.proxy
if (BuildConfig.DEBUG) Log.d(TAG, cmd) , "-p" , config.remotePort.toString
Core.sslocal(cmd.split(" ")) , "-l" , config.localPort.toString
, "-k" , config.sitekey
, "-m" , config.encMethod
, "-f" , (Path.BASE + "ss-local.pid"))
if (BuildConfig.DEBUG) Log.d(TAG, cmd.mkString(" "))
Core.sslocal(cmd.toArray)
} }
def startDnsDaemon() { def startDnsDaemon() {