pEp for Java
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

607 lines
19 KiB

  1. #------------------------------------------------------------------------------#
  2. # Makefile to build GPGME, GnuPG and deps for use with pEpEngine
  3. # based on gnupg-for-android/external/Makefile
  4. #------------------------------------------------------------------------------#
  5. #------------------------------------------------------------------------------#
  6. # Build parameters
  7. # TODO: get params from the outside for multiarch build
  8. NDK_ABI ?= arm
  9. NDK_TOOLCHAIN_VERSION ?= clang
  10. APP_ABI ?= armeabi-v7a
  11. APP_PLATFORM ?= android-18
  12. PEP_PACKAGE_NAME ?= com.pep.k9
  13. all: build assets
  14. build: showsetup libetpan-build gnupg-install gpgme-install uuid-install
  15. #------------------------------------------------------------------------------#
  16. # Manage paths for PREFIX, DESTDIR, LOCAL and PATH
  17. EXTERNAL_ROOT := $(shell pwd)
  18. # install root for built files
  19. DESTDIR = $(EXTERNAL_ROOT)
  20. prefix = /data/data/$(PEP_PACKAGE_NAME)/app_opt
  21. LOCAL := $(DESTDIR)$(prefix)
  22. PATH := ${PATH}:$(NDK_TOOLCHAIN)/bin:$(LOCAL)/bin
  23. #------------------------------------------------------------------------------#
  24. # NDK toolchain integration
  25. # TODO: cleanup.
  26. # Android now has 64-bit and 32-bit versions of the NDK for GNU/Linux. We
  27. # assume that the build platform uses the appropriate version, otherwise the
  28. # user building this will have to manually set NDK_PROCESSOR or NDK_TOOLCHAIN.
  29. CPU := $(shell uname -m)
  30. ifeq ($(CPU),x86_64)
  31. NDK_PROCESSOR=x86_64
  32. else
  33. NDK_PROCESSOR=x86
  34. endif
  35. NDK_SYSROOT=$(ANDROID_NDK_HOME)/sysroot
  36. NDK_UNAME := $(shell uname -s | tr '[A-Z]' '[a-z]')
  37. ifeq ($(NDK_ABI),x86)
  38. HOST = i686-linux-android
  39. NDK_TOOLCHAIN = $(NDK_ABI)-$(NDK_TOOLCHAIN_VERSION)
  40. else
  41. HOST = $(NDK_ABI)-linux-androideabi
  42. NDK_TOOLCHAIN = $(HOST)-$(NDK_TOOLCHAIN_VERSION)
  43. endif
  44. # include Android's build flags
  45. TARGET_ARCH_ABI = $(APP_ABI)
  46. #include $(ANDROID_NDK)/build/core/toolchains/$(NDK_TOOLCHAIN)/setup.mk
  47. #include $(ANDROID_NDK_HOME)/toolchains/$(NDK_TOOLCHAIN)/setup.mk
  48. ANDROID_NDK_HOME=$(EXTERNAL_ROOT)/ndk-18-arm
  49. LD := $(ANDROID_NDK_HOME)/bin/$(HOST)-ld
  50. AR := $(ANDROID_NDK_HOME)/bin/$(HOST)-ar
  51. AS := $(ANDROID_NDK_HOME)/bin/$(HOST)-clang
  52. CC := $(ANDROID_NDK_HOME)/bin/$(HOST)-clang
  53. CXX := $(ANDROID_NDK_HOME)/bin/$(HOST)-clang++
  54. RANLIB := $(ANDROID_NDK_HOME)/bin/$(HOST)-ranlib
  55. #-D_FILE_OFFSET_BITS=64 -DLARGEFILE_SOURCE=1
  56. CFLAGS += -DANDROID -I$(LOCAL)/include $(TARGET_CFLAGS) -fPIE -fPIC
  57. LDFLAGS += -llog -L$(LOCAL)/lib $(TARGET_LDFLAGS) -pie
  58. # change 'release' to 'debug' for unoptimized debug builds
  59. ifeq ($(APP_ABI),armeabi-v7a)
  60. CFLAGS += $(TARGET_arm_debug_CFLAGS)
  61. endif
  62. ifeq ($(APP_ABI),armeabi)
  63. CFLAGS += $(TARGET_thumb_debug_CFLAGS)
  64. endif
  65. #------------------------------------------------------------------------------#
  66. # GNU Tools trickery
  67. # point pkg-config to the .pc files generated from these builds
  68. export PKG_CONFIG_PATH=$(LOCAL)/lib/pkgconfig
  69. # workaround for cross-compiling bug in autoconf
  70. export ac_cv_func_malloc_0_nonnull=yes
  71. #------------------------------------------------------------------------------#
  72. # debugging stuff
  73. showsetup:
  74. @echo "NDK_TOOLCHAIN_VERSION: $(NDK_TOOLCHAIN_VERSION)"
  75. @echo "NDK_TOOLCHAIN: $(NDK_TOOLCHAIN)"
  76. @echo "NDK_SYSROOT: $(NDK_SYSROOT)"
  77. @echo "APP_PLATFORM: $(APP_PLATFORM)"
  78. @echo "APP_ABI: $(APP_ABI)"
  79. @echo "HOST: $(HOST)"
  80. @echo "CC: $(CC)"
  81. @echo "LD: $(LD)"
  82. @echo "CFLAGS: $(CFLAGS)"
  83. @echo "LDFLAGS: $(LDFLAGS)"
  84. #------------------------------------------------------------------------------#
  85. # libgpg-error
  86. EXTERNAL_GIT_REPOS += libgpg-error|git://git.gnupg.org/libgpg-error.git?libgpg-error-1.20
  87. libgpg-error/configure: libgpg-error.src.stamp libgpg-error/configure.ac
  88. cd libgpg-error && ./autogen.sh
  89. libgpg-error/Makefile: libgpg-error/configure
  90. cd libgpg-error && \
  91. ./configure \
  92. CC="$(CC)" \
  93. AR=$(AR) \
  94. RANLIB=$(RANLIB) \
  95. CFLAGS="$(CFLAGS)" \
  96. LDFLAGS="$(LDFLAGS)" \
  97. --disable-doc \
  98. --disable-languages \
  99. --host=$(HOST) \
  100. --prefix=$(LOCAL)
  101. ls -l libgpg-error/libtool
  102. # brute force and ignorance to make libtool comply with android style
  103. sed -i 's,^fast_install=.*,fast_install=needless,' libgpg-error/libtool
  104. sed -i 's,^version_type=.*,version_type=none,' libgpg-error/libtool
  105. sed -i 's,^shlibpath_overrides_runpath=.*,shlibpath_overrides_runpath=yes,' libgpg-error/libtool
  106. sed -i 's,^library_names_spec=.*,library_names_spec="\\$$libname\\$$release\\$$shared_ext",' libgpg-error/libtool
  107. sed -i 's,^soname_spec=.*,soname_spec="\\$$libname\\$$release\\$$shared_ext",' libgpg-error/libtool
  108. sed -i 's,^finish_cmds=.*,finish_cmds="",' libgpg-error/libtool
  109. sed -i 's,^sys_lib_dlsearch_path_spec=.*,sys_lib_dlsearch_path_spec="/lib /usr/lib",' libgpg-error/libtool
  110. libgpg-error/src/.libs/libgpg-error.so: libgpg-error/Makefile
  111. $(MAKE) -C libgpg-error
  112. libgpg-error-build: libgpg-error/src/.libs/libgpg-error.so
  113. $(LOCAL)/lib/libgpg-error.so: libgpg-error/src/.libs/libgpg-error.so
  114. $(MAKE) -C libgpg-error prefix=$(LOCAL) install
  115. ls -l $(LOCAL)/lib/libgpg-error.so*
  116. libgpg-error-install: $(LOCAL)/lib/libgpg-error.so
  117. #------------------------------------------------------------------------------#
  118. # libgcrypt
  119. EXTERNAL_GIT_REPOS += libgcrypt|git://git.gnupg.org/libgcrypt.git?libgcrypt-1.6.4
  120. libgcrypt/configure: libgcrypt.src.stamp libgcrypt/configure.ac
  121. cd libgcrypt && ./autogen.sh
  122. libgcrypt/Makefile: libgcrypt/configure
  123. -patch -N -p1 --reject-file=- libgcrypt/Makefile.am libgcrypt-disable-docs.patch
  124. cd libgcrypt && \
  125. CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
  126. ./configure \
  127. --enable-maintainer-mode \
  128. --host=$(HOST) \
  129. --with-gpg-error-prefix=$(LOCAL) \
  130. --prefix=$(LOCAL)
  131. -patch -N -p1 --reject-file=- libgcrypt/tests/random.c libgcrypt-disable-hanging-random-test.patch
  132. # force use of /dev/urandom
  133. -sed -i 's/NAME_OF_DEV_RANDOM/NAME_OF_DEV_URANDOM/' libgcrypt/random/rndlinux.c
  134. libgcrypt/src/.libs/libgcrypt.so: $(LOCAL)/lib/libgpg-error.so libgcrypt/Makefile
  135. $(MAKE) -C libgcrypt
  136. $(LOCAL)/lib/libgcrypt.so: libgcrypt/src/.libs/libgcrypt.so
  137. $(MAKE) -C libgcrypt prefix=$(LOCAL) install
  138. ls -l $(LOCAL)/lib/libgcrypt.so
  139. libgcrypt-build: libgcrypt/src/.libs/libgcrypt.so
  140. libgcrypt-install: $(LOCAL)/lib/libgcrypt.so
  141. #------------------------------------------------------------------------------#
  142. # libassuan
  143. EXTERNAL_GIT_REPOS += libassuan|git://git.gnupg.org/libassuan.git?libassuan-2.3.0
  144. libassuan/configure: libassuan.src.stamp libassuan/configure.ac
  145. cd libassuan && ./autogen.sh && autoreconf --install --force --verbose
  146. libassuan/Makefile: libassuan/configure
  147. -patch -N -p1 --reject-file=- libassuan/m4/libtool.m4 libtool-Add-Android-Linux-support.patch
  148. cd libassuan && \
  149. CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
  150. ./configure \
  151. --enable-maintainer-mode \
  152. --disable-largefile \
  153. --host=$(HOST) \
  154. --with-gpg-error-prefix=$(LOCAL) \
  155. --prefix=$(LOCAL)
  156. libassuan/src/.libs/libassuan.so: $(LOCAL)/lib/libgpg-error.so libassuan/Makefile
  157. $(MAKE) -C libassuan
  158. $(LOCAL)/lib/libassuan.so: libassuan/src/.libs/libassuan.so
  159. $(MAKE) -C libassuan prefix=$(LOCAL) install
  160. ls -l $(LOCAL)/lib/libassuan.so
  161. libassuan-build: libassuan/src/.libs/libassuan.so
  162. libassuan-install: $(LOCAL)/lib/libassuan.so
  163. #------------------------------------------------------------------------------#
  164. # libksba
  165. EXTERNAL_GIT_REPOS += libksba|git://git.gnupg.org/libksba.git?libksba-1.3.4
  166. libksba/configure: libksba.src.stamp libksba/configure.ac
  167. cd libksba && ./autogen.sh
  168. libksba/Makefile: $(LOCAL)/lib/libgpg-error.so libksba/configure
  169. -patch -N -p1 --reject-file=- libksba/m4/libtool.m4 libtool-Add-Android-Linux-support.patch
  170. cd libksba && \
  171. CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
  172. ./configure \
  173. --enable-maintainer-mode \
  174. --host=$(HOST) \
  175. --with-gpg-error-prefix=$(LOCAL) \
  176. --prefix=$(LOCAL)
  177. libksba/src/.libs/libksba.so: libksba/Makefile
  178. $(MAKE) -C libksba
  179. $(LOCAL)/lib/libksba.so: libksba/src/.libs/libksba.so
  180. $(MAKE) -C libksba prefix=$(LOCAL) install
  181. ls -l $(LOCAL)/lib/libksba.so
  182. libksba-build: libksba/src/.libs/libksba.so
  183. libksba-install: $(LOCAL)/lib/libksba.so
  184. #------------------------------------------------------------------------------#
  185. # npth
  186. EXTERNAL_GIT_REPOS += npth|git://git.gnupg.org/npth.git?npth-1.2
  187. npth/configure: npth.src.stamp npth/configure.ac
  188. cd npth && ./autogen.sh
  189. npth/Makefile: $(LOCAL)/lib/libgpg-error.so npth/configure
  190. cd npth && \
  191. CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
  192. ./configure $(CONFIGURE_ARGS) \
  193. --enable-maintainer-mode \
  194. --host=$(HOST) \
  195. --with-gpg-error-prefix=$(LOCAL) \
  196. --prefix=$(LOCAL)
  197. npth/src/.libs/libnpth.so: npth/Makefile
  198. $(MAKE) -C npth
  199. $(LOCAL)/lib/libnpth.so: npth/src/.libs/libnpth.so
  200. $(MAKE) -C npth prefix=$(LOCAL) install
  201. ls -l $(LOCAL)/lib/libnpth.so
  202. npth-build: npth/src/.libs/libnpth.so
  203. npth-install: $(LOCAL)/lib/libnpth.so
  204. #------------------------------------------------------------------------------#
  205. # curl
  206. EXTERNAL_GIT_REPOS += curl|https://github.com/bagder/curl?curl-7_45_0
  207. curl/configure: curl.src.stamp curl/configure.ac
  208. cd curl && ./buildconf
  209. curl/Makefile: curl/configure
  210. -patch -N -p1 --reject-file=- curl/m4/libtool.m4 libtool-Add-Android-Linux-support.patch
  211. cd curl && \
  212. CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
  213. ./configure \
  214. --host=$(HOST) \
  215. --prefix=$(prefix) \
  216. --with-gnu-ld \
  217. --disable-imap \
  218. --disable-ldap \
  219. --disable-pop3 \
  220. --disable-rtsp \
  221. --disable-smtp
  222. # brute force and ignorance to make libtool comply with android style
  223. sed -i 's,^fast_install=.*,fast_install=needless,' curl/libtool
  224. sed -i 's,^version_type=.*,version_type=none,' curl/libtool
  225. sed -i 's,^shlibpath_overrides_runpath=.*,shlibpath_overrides_runpath=yes,' curl/libtool
  226. sed -i 's,^library_names_spec=.*,library_names_spec="\\$$libname\\$$release\\$$shared_ext",' curl/libtool
  227. sed -i 's,^soname_spec=.*,soname_spec="\\$$libname\\$$release\\$$shared_ext",' curl/libtool
  228. sed -i 's,^finish_cmds=.*,finish_cmds="",' curl/libtool
  229. sed -i 's,^sys_lib_dlsearch_path_spec=.*,sys_lib_dlsearch_path_spec="/lib /usr/lib",' curl/libtool
  230. curl/lib/.libs/libcurl.so: curl/Makefile
  231. $(MAKE) -C curl
  232. $(LOCAL)/lib/libcurl.so: curl/lib/.libs/libcurl.so
  233. $(MAKE) -C curl DESTDIR=$(DESTDIR) prefix=$(prefix) install
  234. ls -l $(LOCAL)/lib/libcurl.so
  235. curl-build: curl/lib/.libs/libcurl.so
  236. curl-install: $(LOCAL)/lib/libcurl.so
  237. #------------------------------------------------------------------------------#
  238. # libiconv
  239. # libiconv from git can't autogen with today's debian packages.
  240. #EXTERNAL_GIT_REPOS += libiconv|git://git.savannah.gnu.org/libiconv.git?5365cc8
  241. # using released package instead
  242. libiconv-1.14.tar.gz:
  243. wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
  244. libiconv.src.stamp: libiconv-1.14.tar.gz
  245. tar xvfz libiconv-1.14.tar.gz
  246. mv libiconv-1.14 libiconv
  247. touch $@
  248. libiconv-src: libiconv.src.stamp
  249. libiconv-clean:
  250. rm -rf libiconv
  251. rm -rf libiconv.src.stamp
  252. EXTERNAL_SRCS += libiconv-src
  253. EXTERNAL_SRCS_CLEAN += libiconv-clean
  254. libiconv/Makefile: libiconv.src.stamp
  255. -patch -N -p1 --reject-file=- libiconv/m4/libtool.m4 libtool-Add-Android-Linux-support-iconv.patch
  256. cp config.sub libiconv/build-aux
  257. cp config.guess libiconv/build-aux
  258. cp config.sub libiconv/libcharset/build-aux
  259. cp config.guess libiconv/libcharset/build-aux
  260. cd libiconv && \
  261. CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
  262. ./configure \
  263. --enable-static \
  264. --enable-maintainer-mode \
  265. --host=$(HOST) \
  266. --with-gnu-ld \
  267. --prefix=$(LOCAL)
  268. libiconv/lib/.libs/libiconv.so: libiconv/Makefile
  269. $(MAKE) -C libiconv
  270. $(LOCAL)/lib/libiconv.so: libiconv/lib/.libs/libiconv.so
  271. $(MAKE) -C libiconv DESTDIR=$(DESTDIR) prefix=$(prefix) install
  272. ls -l $(LOCAL)/lib/libiconv.so
  273. libiconv-build: libiconv/lib/.libs/libiconv.so
  274. libiconv-install: $(LOCAL)/lib/libiconv.so
  275. #------------------------------------------------------------------------------#
  276. # gnupg
  277. EXTERNAL_GIT_REPOS += gnupg|git://git.gnupg.org/gnupg.git?gnupg-2.0.30
  278. gnupg/configure: gnupg.src.stamp gnupg/configure.ac
  279. cd gnupg && ./autogen.sh
  280. gnupg/Makefile: gnupg/configure
  281. -patch -N -p1 --reject-file=- gnupg/gl/stdint_.h gnupg_fix_gmulib_stdint_with_bionic.patch
  282. -patch -N -p1 --reject-file=- gnupg/jnlib/dotlock.c gnupg_use_rename_for_dotlock.patch
  283. cd gnupg && \
  284. CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
  285. ./configure \
  286. --enable-maintainer-mode \
  287. --host=$(HOST) \
  288. --with-gpg-error-prefix=$(LOCAL) \
  289. --with-libgcrypt-prefix=$(LOCAL) \
  290. --with-libassuan-prefix=$(LOCAL) \
  291. --with-ksba-prefix=$(LOCAL) \
  292. --with-libcurl=$(LOCAL) \
  293. --disable-agent \
  294. --disable-scdaemon \
  295. --disable-ldap \
  296. --disable-doc \
  297. --disable-gpgsm \
  298. --prefix=$(prefix)
  299. gnupg/g10/gpg2: $(LOCAL)/lib/libgpg-error.so $(LOCAL)/lib/libgcrypt.so $(LOCAL)/lib/libksba.so $(LOCAL)/lib/libnpth.so $(LOCAL)/lib/libassuan.so $(LOCAL)/lib/libcurl.so $(LOCAL)/lib/libiconv.so gnupg/Makefile
  300. $(MAKE) -C gnupg
  301. $(LOCAL)/bin/gpg2: gnupg/g10/gpg2 gnupg/configure
  302. $(MAKE) -C gnupg prefix=$(LOCAL) install
  303. ls -l $(LOCAL)/bin/gpg2
  304. gnupg-build: gnupg/g10/gpg2
  305. gnupg-install: $(LOCAL)/bin/gpg2
  306. install -d $(LOCAL)/etc/gnupg
  307. install -d $(LOCAL)/var/run/gnupg
  308. install -d $(LOCAL)/var/cache/gnupg
  309. #------------------------------------------------------------------------------#
  310. # gpgme
  311. EXTERNAL_GIT_REPOS += gpgme|git://git.gnupg.org/gpgme.git?gpgme-1.8.0
  312. gpgme/configure: gpgme.src.stamp gpgme/configure.ac
  313. cd gpgme && ./autogen.sh
  314. ifneq ("x$(findstring '64',$(HOST))x","xx")
  315. gpgme_32b_force_no_largefile =
  316. else
  317. gpgme_32b_force_no_largefile = --disable-largefile
  318. endif
  319. gpgme/Makefile: gpgme/configure
  320. -patch -N -p1 --reject-file=- gpgme/m4/libtool.m4 libtool-Add-Android-Linux-support.patch
  321. cd gpgme && \
  322. CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
  323. ./configure \
  324. --host=$(HOST) \
  325. $(gpgme_32b_force_no_largefile) \
  326. --enable-maintainer-mode \
  327. --with-gpg-error-prefix=$(LOCAL) \
  328. --with-libassuan-prefix=$(LOCAL) \
  329. --enable-fixed-path=$(prefix)/bin \
  330. --disable-glibtest \
  331. --disable-gpg-test \
  332. --disable-gpgsm-test \
  333. --disable-gpgconf-test \
  334. --disable-g13-test \
  335. --prefix=$(prefix) \
  336. --enable-languages=cl
  337. gpgme/src/.libs/libgpgme.so: gpgme/Makefile
  338. $(MAKE) -C gpgme
  339. $(LOCAL)/lib/libgpgme.so: gpgme/src/.libs/libgpgme.so
  340. $(MAKE) -C gpgme DESTDIR=$(DESTDIR) prefix=$(prefix) install
  341. gpgme-build: gpgme/src/.libs/libgpgme.so
  342. gpgme-install: $(LOCAL)/bin/gpg2 $(LOCAL)/lib/libgpgme.so
  343. #------------------------------------------------------------------------------#
  344. # libetpan
  345. EXTERNAL_GIT_REPOS += libetpan|https://github.com/fdik/libetpan.git?HEAD
  346. libetpan/build-android/libetpan-android-1.zip: libiconv-install libetpan.src.stamp
  347. cd libetpan/build-android; ICONV_PREFIX=$(LOCAL) bash ./build.sh
  348. libetpan-build: libetpan/build-android/libetpan-android-1.zip
  349. libetpan-cleanzip:
  350. rm -f libetpan/build-android/libetpan-android-1.zip
  351. #------------------------------------------------------------------------------#
  352. # uuid
  353. # using released package from debian. official ftp wasn't available today
  354. ossp-uuid_1.6.2.orig.tar.gz:
  355. wget http://http.debian.net/debian/pool/main/o/ossp-uuid/ossp-uuid_1.6.2.orig.tar.gz
  356. md5sum -c ossp-uuid_1.6.2.orig.tar.gz.md5
  357. uuid.src.stamp: ossp-uuid_1.6.2.orig.tar.gz
  358. tar xvfz ossp-uuid_1.6.2.orig.tar.gz
  359. mv uuid-1.6.2 uuid
  360. touch $@
  361. uuid-src: uuid.src.stamp
  362. uuid-clean:
  363. rm -rf uuid
  364. rm -rf uuid.src.stamp
  365. EXTERNAL_SRCS += uuid-src
  366. EXTERNAL_SRCS_CLEAN += uuid-clean
  367. uuid/Makefile: uuid.src.stamp
  368. sed -i 's,AC_CHECK_VA_COPY(),,' uuid/uuid.ac
  369. cd uuid && autoconf
  370. -patch -N -p1 --reject-file=- uuid/libtool.m4 libtool-Add-Android-Linux-support-iconv.patch
  371. cp config.sub uuid
  372. cp config.guess uuid
  373. cd uuid && \
  374. CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
  375. ./configure \
  376. --enable-static \
  377. --host=$(HOST) \
  378. --with-gnu-ld \
  379. --prefix=$(LOCAL)
  380. uuid/.libs/libuuid.so: uuid/Makefile
  381. $(MAKE) -C uuid
  382. $(LOCAL)/lib/libuuid.so: uuid/.libs/libuuid.so
  383. # install fails copying uuid cmdline tool, but libs are copied ...
  384. -$(MAKE) -C uuid DESTDIR=$(DESTDIR) prefix=$(prefix) install
  385. echo "****** THIS ERROR WAS WILLINGLY IGNORED ******"
  386. ls -l $(LOCAL)/lib/libuuid.so
  387. uuid-build: uuid/.libs/libuuid.so
  388. uuid-install: $(LOCAL)/lib/libuuid.so
  389. #------------------------------------------------------------------------------#
  390. # assets for Android app
  391. ASSETS := $(EXTERNAL_ROOT)/assets
  392. assets: clean-assets
  393. # add the new stuff
  394. install -d $(ASSETS)
  395. cp -a $(LOCAL)/* $(ASSETS)
  396. # remove all the stuff we don't need
  397. rm -f $(ASSETS)/bin/*-static
  398. rm -f $(ASSETS)/bin/curl*
  399. rm -f $(ASSETS)/lib/*.a $(ASSETS)/lib/*.la
  400. # remove lib symlinks since Android AssetManager copies them as files
  401. rm -f $(ASSETS)/lib/*.so
  402. # remove .so.0 symlink and rename the .so.0.12.0 file to it
  403. for f in $(ASSETS)/lib/*.so.[0-9]*; do \
  404. echo $$f; \
  405. test ! -L $$f || \
  406. (rm $$f && mv $$f.[0-9]* $$f); \
  407. done
  408. rm -rf $(ASSETS)/include
  409. rm -rf $(ASSETS)/share/man $(ASSETS)/share/info $(ASSETS)/share/doc
  410. rm -rf $(ASSETS)/tests
  411. #------------------------------------------------------------------------------#
  412. # Clone update and archive external projects GIT repos
  413. # Local clone is in external/$project.git while
  414. # selected commit is archived in external/$project
  415. define per_repo_targets
  416. $(1).git.stamp:
  417. git clone $(2) $(1).git
  418. touch $(1).git.stamp
  419. $(1).git_update: $(1).git.stamp
  420. cd $(1).git; git pull
  421. touch $(1).git.stamp
  422. $(1).src.stamp: $(1).git.stamp
  423. rm -rf $(1)
  424. mkdir $(1)
  425. (cd $(1).git; git archive --format=tar $(3)) | tar -C $(1) -x
  426. touch $(1).src.stamp
  427. $(1)-src: $(1).src.stamp
  428. $(1)-clean:
  429. rm -rf $(1)
  430. rm -f $(1).src.stamp
  431. EXTERNAL_LOCAL_GITS += $(1).git.stamp
  432. EXTERNAL_LOCAL_GITS_UPDATE += $(1).git_update
  433. EXTERNAL_SRCS += $(1)-src
  434. EXTERNAL_SRCS_CLEAN += $(1)-clean
  435. endef
  436. define per_repo
  437. $(call per_repo_targets,\
  438. $(1),\
  439. $(word 1,$(subst ?, ,$(2))),\
  440. $(word 2,$(subst ?, ,$(2))))
  441. endef
  442. $(foreach repo, $(EXTERNAL_GIT_REPOS), $(eval $(call per_repo,\
  443. $(word 1,$(subst |, ,$(repo))),\
  444. $(word 2,$(subst |, ,$(repo))))))
  445. git_clones: $(EXTERNAL_LOCAL_GITS)
  446. git_update: $(EXTERNAL_LOCAL_GITS_UPDATE)
  447. #------------------------------------------------------------------------------#
  448. # clean
  449. clean-assets:
  450. rm -rf $(ASSETS)
  451. clean-install:
  452. rm -rf $(DESTDIR)/data
  453. clean: $(EXTERNAL_SRCS_CLEAN) clean-assets clean-install libetpan-cleanzip
  454. clean-all: clean
  455. rm -rf *.git
  456. rm -rf *.stamp
  457. #------------------------------------------------------------------------------#
  458. .PHONY = clean clean-install clean-assets libetpan-cleanzip\
  459. libgpg-error-build libgpg-error-install \
  460. libgcrypt-build libgcrypt-install \
  461. libassuan-build libassuan-install \
  462. libksba-build libksba-install \
  463. libnpth-build libnpth-install \
  464. libiconv-build libiconv-install \
  465. uuid-build uuid-install \
  466. gnupg-build gnupg-install\
  467. gpgme-build gpgme-install\
  468. curl-build curl-install \
  469. assets clean-assets clean-install \
  470. $(EXTERNAL_LOCAL_GITS_UPDATE) $(EXTERNAL_SRCS) $(EXTERNAL_SRCS_CLEAN) \
  471. showsetup