shithub: drawterm-fdroid

Download patch

ref: 8d1d00cf25eb46f29948bc021f153e4cc4c5c598
parent: 880c99727c9536f964faba5bbfb0d25d6029dffe
author: Eli Cohen <echoline@gmail.com>
date: Tue Feb 1 20:24:17 EST 2022

separate Android configuration variables into Make.android.config

--- a/Make.android
+++ b/Make.android
@@ -1,6 +1,5 @@
 # Android
-SDKPREFIX=$(HOME)/Android/Sdk
-JAVA_HOME=/usr
+include Make.android.config
 OBJS=lib/arm64-v8a/libdrawterm.so lib/armeabi-v7a/libdrawterm.so lib/x86/libdrawterm.so lib/x86_64/libdrawterm.so
 
 all: drawterm.apk
@@ -25,14 +24,14 @@
 	CONF=android-amd64 make clean;
 
 drawterm.apk: drawterm-signed.apk
-	$(SDKPREFIX)/build-tools/30.0.3/zipalign -v -f 4 $< $@
+	$(SDKPREFIX)/build-tools/$(BUILDTOOLS)/zipalign -v -f 4 $< $@
 
 drawterm-signed.apk: drawterm-unsigned.apk drawterm.keystore
 	$(JAVA_HOME)/bin/jarsigner -verbose -keystore ./drawterm.keystore -signedjar $@ $< drawtermKey
 
 drawterm-unsigned.apk: $(OBJS)
-	$(SDKPREFIX)/build-tools/30.0.3/aapt package -v -f -M gui-android/AndroidManifest.xml -S gui-android/res -I $(SDKPREFIX)/platforms/android-21/android.jar -F $@ gui-android/bin
-	$(SDKPREFIX)/build-tools/30.0.3/aapt add $@ $(OBJS)
+	$(SDKPREFIX)/build-tools/$(BUILDTOOLS)/aapt package -v -f -M gui-android/AndroidManifest.xml -S gui-android/res -I $(SDKPREFIX)/platforms/android-$(PLATFORM)/android.jar -F $@ gui-android/bin
+	$(SDKPREFIX)/build-tools/$(BUILDTOOLS)/aapt add $@ $(OBJS)
 
 drawterm.keystore:
 	$(JAVA_HOME)/bin/keytool -genkeypair -validity 1000 -dname "CN=9front,O=Android,C=US" -keystore $@ -alias drawtermKey -keyalg RSA -v
--- a/Make.android-386
+++ b/Make.android-386
@@ -1,7 +1,5 @@
 # Android
-SDKPREFIX=$(HOME)/Android/Sdk
-NDKPREFIX=$(SDKPREFIX)/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64/bin
-JAVA_HOME=/usr
+include $(ROOT)/Make.android.config
 
 PTHREAD=-pthread
 AR=$(NDKPREFIX)/i686-linux-android-ar
@@ -8,7 +6,7 @@
 AS=$(NDKPREFIX)/i686-linux-android-as
 RANLIB=$(NDKPREFIX)/i686-linux-android-ranlib
 STRIP=$(NDKPREFIX)/i686-linux-android-strip
-CC=$(NDKPREFIX)/i686-linux-android21-clang
+CC=$(NDKPREFIX)/i686-linux-android$(PLATFORM)-clang
 CFLAGS=-Wall -Wno-missing-braces -ggdb -I$(ROOT) -I$(ROOT)/include -I$(ROOT)/kern -c -Dmain=dt_main -fPIC
 O=o
 OS=posix
--- a/Make.android-amd64
+++ b/Make.android-amd64
@@ -1,7 +1,5 @@
 # Android
-SDKPREFIX=$(HOME)/Android/Sdk
-NDKPREFIX=$(SDKPREFIX)/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64/bin
-JAVA_HOME=/usr
+include $(ROOT)/Make.android.config
 
 PTHREAD=-pthread
 AR=$(NDKPREFIX)/x86_64-linux-android-ar
@@ -8,7 +6,7 @@
 AS=$(NDKPREFIX)/x86_64-linux-android-as
 RANLIB=$(NDKPREFIX)/x86_64-linux-android-ranlib
 STRIP=$(NDKPREFIX)/x86_64-linux-android-strip
-CC=$(NDKPREFIX)/x86_64-linux-android21-clang
+CC=$(NDKPREFIX)/x86_64-linux-android$(PLATFORM)-clang
 CFLAGS=-Wall -Wno-missing-braces -ggdb -I$(ROOT) -I$(ROOT)/include -I$(ROOT)/kern -c -Dmain=dt_main -fPIC
 O=o
 OS=posix
--- a/Make.android-arm
+++ b/Make.android-arm
@@ -1,7 +1,5 @@
 # Android
-SDKPREFIX=$(HOME)/Android/Sdk
-NDKPREFIX=$(SDKPREFIX)/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64/bin
-JAVA_HOME=/usr
+include $(ROOT)/Make.android.config
 
 PTHREAD=-pthread
 AR=$(NDKPREFIX)/arm-linux-androideabi-ar
@@ -8,7 +6,7 @@
 AS=$(NDKPREFIX)/arm-linux-androideabi-as
 RANLIB=$(NDKPREFIX)/arm-linux-androideabi-ranlib
 STRIP=$(NDKPREFIX)/arm-linux-androideabi-strip
-CC=$(NDKPREFIX)/armv7a-linux-androideabi21-clang
+CC=$(NDKPREFIX)/armv7a-linux-androideabi$(PLATFORM)-clang
 CFLAGS=-Wall -Wno-missing-braces -ggdb -I$(ROOT) -I$(ROOT)/include -I$(ROOT)/kern -c -Dmain=dt_main -fPIC
 O=o
 OS=posix
--- a/Make.android-arm64
+++ b/Make.android-arm64
@@ -1,7 +1,5 @@
 # Android
-SDKPREFIX=$(HOME)/Android/Sdk
-NDKPREFIX=$(SDKPREFIX)/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64/bin
-JAVA_HOME=/usr
+include $(ROOT)/Make.android.config
 
 PTHREAD=-pthread
 AR=$(NDKPREFIX)/aarch64-linux-android-ar
@@ -8,7 +6,7 @@
 AS=$(NDKPREFIX)/aarch64-linux-android-as
 RANLIB=$(NDKPREFIX)/aarch64-linux-android-ranlib
 STRIP=$(NDKPREFIX)/aarch64-linux-android-strip
-CC=$(NDKPREFIX)/aarch64-linux-android21-clang
+CC=$(NDKPREFIX)/aarch64-linux-android$(PLATFORM)-clang
 CFLAGS=-Wall -Wno-missing-braces -ggdb -I$(ROOT) -I$(ROOT)/include -I$(ROOT)/kern -c -Dmain=dt_main -fPIC
 O=o
 OS=posix
--- /dev/null
+++ b/Make.android.config
@@ -1,0 +1,6 @@
+SDKPREFIX=$(HOME)/Android/Sdk
+JAVA_HOME=/usr
+BUILDTOOLS=30.0.3
+PLATFORM=21
+NDKPREFIX=$(SDKPREFIX)/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64/bin
+
--- a/README
+++ b/README
@@ -7,7 +7,7 @@
 
 
 INSTALLATION
---------------
+------------
 To build on Unix, run CONF=unix make.
 
 To build on Solaris using Sun cc, run CONF=sun make.
@@ -18,15 +18,16 @@
 
 To build on Mac OS X with Cocoa, run CONF=osx-cocoa make and "cp drawterm gui-cocoa/drawterm.app/".
 
-To build for Android, make sure Make.android* and gui-android/Makefile are correct for your build and target systems, then run make -f Make.android
+To build for Android, make sure Make.android.config is correct for your build and target systems, then run "make -f Make.android"
 
+
 USAGE
--------
+-----
 On Android the five checkboxes at the top represent the three mouse buttons and mousewheel, determining which "buttons" are clicked. The "kb" button toggles the soft keyboard.
 
 
 CAVEATS
---------
+-------
 Be aware that right now on Android the login details are saved as a plaintext string if saved, and there is no secstore support.
 
 
--- a/gui-android/Makefile
+++ b/gui-android/Makefile
@@ -1,5 +1,6 @@
 ROOT=..
 include ../Make.config
+include ../Make.android.config
 LIB=libgui.a
 
 OFILES=\
@@ -13,11 +14,11 @@
 	$(RANLIB) $(LIB)
 
 gen/org/echoline/drawterm/R.java: $(shell find res/ -type f)
-	$(SDKPREFIX)/build-tools/30.0.3/aapt package -f -m -M AndroidManifest.xml -I $(SDKPREFIX)/platforms/android-21/android.jar -S res/ -J gen
+	$(SDKPREFIX)/build-tools/$(BUILDTOOLS)/aapt package -f -m -M AndroidManifest.xml -I $(SDKPREFIX)/platforms/android-$(PLATFORM)/android.jar -S res/ -J gen
 
 bin/classes.dex: obj/org/echoline/drawterm/MainActivity.class obj/org/echoline/drawterm/DrawTermThread.class obj/org/echoline/drawterm/MySurfaceView.class
-	$(SDKPREFIX)/build-tools/30.0.3/dx --dex --verbose --output=$@ obj/
+	$(SDKPREFIX)/build-tools/$(BUILDTOOLS)/dx --dex --verbose --output=$@ obj/
 
 obj/org/echoline/drawterm/%.class: java/org/echoline/drawterm/%.java
-	$(JAVA_HOME)/bin/javac -d obj/ -classpath $(SDKPREFIX)/platforms/android-21/android.jar -sourcepath java java/org/echoline/drawterm/$*.java gen/org/echoline/drawterm/R.java
+	$(JAVA_HOME)/bin/javac -d obj/ -classpath $(SDKPREFIX)/platforms/android-$(PLATFORM)/android.jar -sourcepath java java/org/echoline/drawterm/*.java gen/org/echoline/drawterm/R.java