aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-11-27 13:45:19 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2017-11-27 18:16:56 +0100
commit7f3b8207f52de5b7af5d86b4aaffb05e7c4fca69 (patch)
tree874293300e953c51dd498cbb40eaa51458bb098f
parentVersion bump (diff)
downloadandroid_kernel_wireguard-7f3b8207f52de5b7af5d86b4aaffb05e7c4fca69.tar.xz
android_kernel_wireguard-7f3b8207f52de5b7af5d86b4aaffb05e7c4fca69.zip
Move back to manual fetching
Repo's submodule support is broken. Android bitrot is a thing.
-rw-r--r--.gitignore2
-rw-r--r--.gitmodules8
-rw-r--r--Android.mk14
-rwxr-xr-xfetch.sh22
-rwxr-xr-xgenerate-tools-filelist.sh5
m---------libmnl0
m---------wireguard0
7 files changed, 37 insertions, 14 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ecea3bb
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+libmnl/
+wireguard/
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index a73c28e..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,8 +0,0 @@
-[submodule "wireguard"]
- path = wireguard
- url = https://git.zx2c4.com/WireGuard
- branch = master
-[submodule "libmnl"]
- path = libmnl
- url = git://git.netfilter.org/libmnl
- branch = master
diff --git a/Android.mk b/Android.mk
index c6d8dfb..0ac774e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,19 +1,21 @@
WIREGUARD_PATH := $(call my-dir)
+fetch:
+ cd $(WIREGUARD_PATH) && ./fetch.sh
+
TARGET_KERNEL_BINARIES: patch-wireguard
-patch-wireguard:
+patch-wireguard: fetch
ln -vsfT "$$(realpath --relative-to="$(TARGET_KERNEL_SOURCE)/net)" "$(WIREGUARD_PATH)/wireguard/src")" "$(TARGET_KERNEL_SOURCE)/net/wireguard"
grep -q wireguard "$(TARGET_KERNEL_SOURCE)/net/Makefile" || sed -i "/^obj-\\\$$(CONFIG_NETFILTER).*+=/a obj-\$$(CONFIG_WIREGUARD) += wireguard/" "$(TARGET_KERNEL_SOURCE)/net/Makefile"
grep -q wireguard "$(TARGET_KERNEL_SOURCE)/net/Kconfig" || sed -i "/^if INET\$$/a source \"net/wireguard/Kconfig\"" "$(TARGET_KERNEL_SOURCE)/net/Kconfig"
-.PHONY: patch-wireguard
+.PHONY: patch-wireguard fetch
LOCAL_PATH := $(WIREGUARD_PATH)
include $(CLEAR_VARS)
-MNL := $(WIREGUARD_PATH)/libmnl/src
-WG := $(WIREGUARD_PATH)/wireguard/src/tools
-LOCAL_SRC_FILES := $(subst $(WIREGUARD_PATH)/,,$(wildcard $(WG)/*.c $(MNL)/*.c))
-LOCAL_C_INCLUDES := $(MNL)/ $(WG)/ $(MNL)/../include/
+LOCAL_SRC_FILES := $(shell cd $(WIREGUARD_PATH) && ./generate-tools-filelist.sh)
+$(foreach F,$(LOCAL_SRC_FILES),$(WIREGUARD_PATH)/$(F)): fetch
+LOCAL_C_INCLUDES := $(WIREGUARD_PATH)/libmnl/src/ $(WIREGUARD_PATH)/libmnl/include/ $(WIREGUARD_PATH)/wireguard/src/tools/
LOCAL_CFLAGS := -O3 -std=gnu11 -D_GNU_SOURCE -DHAVE_VISIBILITY_HIDDEN -DRUNSTATEDIR="\"/data/local/run\"" -Wno-pointer-arith -Wno-unused-parameter
LOCAL_MODULE := wg
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
diff --git a/fetch.sh b/fetch.sh
new file mode 100755
index 0000000..0556dfb
--- /dev/null
+++ b/fetch.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+set -e
+WIREGUARD_VERSION=0.0.20171127
+LIBMNL_VERSION=1.0.4
+USER_AGENT="WireGuard-AndroidROMBuild/0.1 ($(uname -a))"
+
+fetch_wireguard() {
+ [[ -d wireguard && -f wireguard/src/version.h && $(< wireguard/src/version.h) == *"\"$WIREGUARD_VERSION\""* ]] && return 0
+ rm -rf wireguard
+ mkdir wireguard
+ curl -A "$USER_AGENT" -L "https://git.zx2c4.com/WireGuard/snapshot/WireGuard-$WIREGUARD_VERSION.tar.xz" | tar -C "wireguard" --strip-components=1 -xJf -
+}
+
+fetch_libmnl() {
+ [[ -d libmnl && -f libmnl/configure.ac && $(< libmnl/configure.ac) == *"[$LIBMNL_VERSION]"* ]] && return 0
+ rm -rf libmnl
+ mkdir libmnl
+ curl -A "$USER_AGENT" -L "https://www.netfilter.org/projects/libmnl/files/libmnl-$LIBMNL_VERSION.tar.bz2" | tar -C libmnl --strip-components=1 -xjf -
+}
+
+fetch_wireguard
+fetch_libmnl
diff --git a/generate-tools-filelist.sh b/generate-tools-filelist.sh
new file mode 100755
index 0000000..34d8843
--- /dev/null
+++ b/generate-tools-filelist.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+set -e
+
+. ./fetch.sh
+echo wireguard/src/tools/*.c libmnl/src/*.c
diff --git a/libmnl b/libmnl
deleted file mode 160000
-Subproject 0930a63252958f40bb0f9d09de86985c25cea03
diff --git a/wireguard b/wireguard
deleted file mode 160000
-Subproject e4b7fec69135ecc50b3a105fbf09efc9e037e11