Skip to content

Commit 65d30ea

Browse files
committed
slightly better fix
1 parent 62b2a94 commit 65d30ea

File tree

4 files changed

+22
-34
lines changed

4 files changed

+22
-34
lines changed

scripts/android.mk

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ NDK_HOME := $(SRCDIR)/$(NDK_DIR)/$(TARGET)
33
DLLEXT := .so
44
TOOLCHAIN := $(NDK_HOME)/toolchains/llvm/prebuilt/linux-x86_64
55
SYSROOT := $(TOOLCHAIN)/sysroot
6-
PREFIX := $(SYSROOT)/usr
6+
PREFIX := $(DESTDIR)/$(TARGET)
77
TOOLCHAIN_FILE := $(SRCDIR)/$(TARGET).cmake
88
PROTOC := $(DESTDIR)/host/bin/protoc
99

@@ -22,7 +22,7 @@ libvpx_CONFIGURE := --prefix=$(PREFIX) --sdk-path=$(NDK_HOME) --libc=$(SYSROOT)
2222
toxcore_CONFIGURE := -DCMAKE_INSTALL_PREFIX:PATH=$(PREFIX) -DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN_FILE) -DANDROID_CPU_FEATURES=$(NDK_HOME)/sources/android/cpufeatures/cpu-features.c -DENABLE_STATIC=ON -DENABLE_SHARED=OFF
2323
tox4j_CONFIGURE := -DCMAKE_INSTALL_PREFIX:PATH=$(PREFIX) -DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN_FILE) -DANDROID_CPU_FEATURES=$(NDK_HOME)/sources/android/cpufeatures/cpu-features.c
2424

25-
build: $(TOOLCHAIN)/tox4j.stamp
25+
build: $(PREFIX)/tox4j.stamp
2626

2727
test: build
2828
@echo "No tests for Android builds"
@@ -34,8 +34,12 @@ $(NDK_HOME):
3434
# clutters the Travis CI cache.
3535
test -f $(NDK_PACKAGE) || curl -s $(NDK_URL) -o $(NDK_PACKAGE)
3636
7z x $(NDK_PACKAGE) $(foreach x,$(NDK_FILES),'-ir!$(NDK_DIR)/$x')
37-
rm -rf $@
37+
test -d $@ && find $@ -exec chmod +w {} \; && rm -rf $@
3838
mv $(NDK_DIR) $@
39+
mkdir -p $(TOOLCHAIN)/bin
40+
ln -f $(CC) $(TOOLCHAIN)/bin/$(TARGET)-gcc
41+
ln -f $(CXX) $(TOOLCHAIN)/bin/$(TARGET)-g++
42+
find $@ -exec chmod -w {} \;
3943
@$(POST_RULE)
4044

4145
$(TOOLCHAIN_FILE): $(NDK_HOME) scripts/android.mk

scripts/build-host

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export CXX := $(shell which clang++ || which g++)
1414
export PKG_CONFIG_PATH := $(PREFIX)/lib/pkgconfig
1515
export TOX4J_PLATFORM := $(shell perl -e 'print $$^O')-$(shell uname -m)
1616

17-
build: $(TOOLCHAIN)/tox4j.stamp
17+
build: $(PREFIX)/tox4j.stamp
1818
sbt -Djava.library.path=$(PREFIX)/lib "publishLocal" "makeScripts"
1919

2020
test: build

scripts/dependencies.mk

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
PRE_RULE = (echo "=== Building $@ ==="; ls -ld $@; true) && ls -ld $+
22
POST_RULE = ls -ld $@
33

4-
$(BUILDDIR)/tox4j/Makefile: $(CURDIR)/cpp/CMakeLists.txt $(TOOLCHAIN_FILE) $(foreach i,protobuf toxcore,$(TOOLCHAIN)/$i.stamp)
4+
$(BUILDDIR)/tox4j/Makefile: $(CURDIR)/cpp/CMakeLists.txt $(TOOLCHAIN_FILE) $(foreach i,protobuf toxcore,$(PREFIX)/$i.stamp)
55
@$(PRE_RULE)
66
mkdir -p $(@D)
77
cd $(@D) && cmake $(<D) $($(notdir $(@D))_CONFIGURE)
88
@$(POST_RULE)
99

10-
$(TOOLCHAIN)/tox4j.stamp: $(BUILDDIR)/tox4j/Makefile
10+
$(PREFIX)/tox4j.stamp: $(BUILDDIR)/tox4j/Makefile
1111
@$(PRE_RULE)
1212
$(MAKE) -C $(<D) install
1313
mkdir -p $(@D) && touch $@
@@ -19,7 +19,7 @@ $(TOOLCHAIN)/tox4j.stamp: $(BUILDDIR)/tox4j/Makefile
1919
$(SRCDIR)/protobuf:
2020
git clone --depth=1 --branch=v3.11.1 https://github.com/google/protobuf $@
2121

22-
$(TOOLCHAIN)/protobuf.stamp: $(SRCDIR)/protobuf $(TOOLCHAIN_FILE) $(PROTOC)
22+
$(PREFIX)/protobuf.stamp: $(SRCDIR)/protobuf $(TOOLCHAIN_FILE) $(PROTOC)
2323
@$(PRE_RULE)
2424
cd $< && autoreconf -fi
2525
mkdir -p $(BUILDDIR)/$(notdir $<)
@@ -38,8 +38,8 @@ $(SRCDIR)/toxcore:
3838
git clone --depth=1 https://github.com/TokTok/c-toxcore $@; \
3939
fi
4040

41-
$(TOOLCHAIN)/toxcore.stamp: $(foreach f,$(shell cd $(SRCDIR)/toxcore && git ls-files),$(SRCDIR)/toxcore/$f)
42-
$(TOOLCHAIN)/toxcore.stamp: $(SRCDIR)/toxcore $(TOOLCHAIN_FILE) $(foreach i,libsodium opus libvpx,$(TOOLCHAIN)/$i.stamp)
41+
$(PREFIX)/toxcore.stamp: $(foreach f,$(shell cd $(SRCDIR)/toxcore && git ls-files),$(SRCDIR)/toxcore/$f)
42+
$(PREFIX)/toxcore.stamp: $(SRCDIR)/toxcore $(TOOLCHAIN_FILE) $(foreach i,libsodium opus libvpx,$(PREFIX)/$i.stamp)
4343
@$(PRE_RULE)
4444
mkdir -p $(BUILDDIR)/$(notdir $<)
4545
cd $(BUILDDIR)/$(notdir $<) && cmake $(SRCDIR)/$(notdir $<) $($(notdir $<)_CONFIGURE) -DMUST_BUILD_TOXAV=ON -DBOOTSTRAP_DAEMON=OFF
@@ -53,7 +53,7 @@ $(TOOLCHAIN)/toxcore.stamp: $(SRCDIR)/toxcore $(TOOLCHAIN_FILE) $(foreach i,libs
5353
$(SRCDIR)/libsodium:
5454
git clone --depth=1 --branch=1.0.18 https://github.com/jedisct1/libsodium $@
5555

56-
$(TOOLCHAIN)/libsodium.stamp: $(SRCDIR)/libsodium $(TOOLCHAIN_FILE)
56+
$(PREFIX)/libsodium.stamp: $(SRCDIR)/libsodium $(TOOLCHAIN_FILE)
5757
@$(PRE_RULE)
5858
cd $< && autoreconf -fi
5959
mkdir -p $(BUILDDIR)/$(notdir $<)
@@ -68,7 +68,7 @@ $(TOOLCHAIN)/libsodium.stamp: $(SRCDIR)/libsodium $(TOOLCHAIN_FILE)
6868
$(SRCDIR)/opus:
6969
git clone --depth=1 https://github.com/xiph/opus $@
7070

71-
$(TOOLCHAIN)/opus.stamp: $(SRCDIR)/opus $(TOOLCHAIN_FILE)
71+
$(PREFIX)/opus.stamp: $(SRCDIR)/opus $(TOOLCHAIN_FILE)
7272
@$(PRE_RULE)
7373
cd $< && autoreconf -fi
7474
mkdir -p $(BUILDDIR)/$(notdir $<)
@@ -84,11 +84,9 @@ $(SRCDIR)/libvpx:
8484
git clone --depth=1 --branch=v1.6.0 https://github.com/webmproject/libvpx $@
8585
cd $@ && patch -p1 < $(CURDIR)/scripts/patches/libvpx.patch
8686

87-
$(TOOLCHAIN)/libvpx.stamp: $(SRCDIR)/libvpx $(TOOLCHAIN_FILE)
87+
$(PREFIX)/libvpx.stamp: $(SRCDIR)/libvpx $(TOOLCHAIN_FILE)
8888
@$(PRE_RULE)
8989
echo $(PATH)
90-
mkdir -p $(TOOLCHAIN)/bin
91-
ln -f $(CC) $(TOOLCHAIN)/bin/aarch64-linux-android-gcc
9290
mkdir -p $(BUILDDIR)/$(notdir $<)
9391
cd $(BUILDDIR)/$(notdir $<) && $(SRCDIR)/$(notdir $<)/configure $($(notdir $<)_CONFIGURE)
9492
$(MAKE) -C $(BUILDDIR)/$(notdir $<) install

scripts/patches/libvpx.patch

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/build/make/configure.sh b/build/make/configure.sh
2-
index 4f0071b..a4b7c58 100644
2+
index 4f0071b..f8e7b69 100644
33
--- a/build/make/configure.sh
44
+++ b/build/make/configure.sh
55
@@ -918,92 +918,6 @@ process_common_toolchain() {
@@ -95,7 +95,7 @@ index 4f0071b..a4b7c58 100644
9595
case ${tgt_os} in
9696
none*)
9797
disable_feature multithread
98-
@@ -1015,17 +929,23 @@ EOF
98+
@@ -1015,10 +929,16 @@ EOF
9999
die "Must specify --sdk-path for Android builds."
100100
fi
101101

@@ -109,25 +109,11 @@ index 4f0071b..a4b7c58 100644
109109
COMPILER_LOCATION=`find "${SDK_PATH}" \
110110
- -name "arm-linux-androideabi-gcc*" -print -quit`
111111
- TOOLCHAIN_PATH=${COMPILER_LOCATION%/*}/arm-linux-androideabi-
112-
- CC=${TOOLCHAIN_PATH}gcc
113-
- CXX=${TOOLCHAIN_PATH}g++
114-
- AR=${TOOLCHAIN_PATH}ar
115-
- LD=${TOOLCHAIN_PATH}gcc
116-
- AS=${TOOLCHAIN_PATH}as
117-
- STRIP=${TOOLCHAIN_PATH}strip
118-
- NM=${TOOLCHAIN_PATH}nm
119112
+ -name "${TRIPLE}-gcc*" -print -quit`
120-
+ TOOLCHAIN_PATH=${COMPILER_LOCATION%/*}/${TRIPLE}
121-
+ CC=${TOOLCHAIN_PATH}21-clang
122-
+ CXX=${TOOLCHAIN_PATH}21-clang++
123-
+ AR=${TOOLCHAIN_PATH}-ar
124-
+ LD=${TOOLCHAIN_PATH}21-clang
125-
+ AS=${TOOLCHAIN_PATH}-as
126-
+ STRIP=${TOOLCHAIN_PATH}-strip
127-
+ NM=${TOOLCHAIN_PATH}-nm
128-
129-
if [ -z "${alt_libc}" ]; then
130-
alt_libc=`find "${SDK_PATH}" -name arch-arm -print | \
113+
+ TOOLCHAIN_PATH=${COMPILER_LOCATION%/*}/${TRIPLE}-
114+
CC=${TOOLCHAIN_PATH}gcc
115+
CXX=${TOOLCHAIN_PATH}g++
116+
AR=${TOOLCHAIN_PATH}ar
131117
@@ -1041,9 +961,11 @@ EOF
132118
add_ldflags "--sysroot=${alt_libc}"
133119
fi

0 commit comments

Comments
 (0)