build-linux/Makefile
author Volker Birk <vb@pep.foundation>
Tue, 16 Jan 2018 08:48:01 +0100
changeset 2390 8c00cb3e29ff
parent 1513 e7f7e42385b5
child 4105 982548344703
permissions -rw-r--r--
Windoze…
     1 # This file is under GNU General Public License 3.0
     2 # see LICENSE.txt
     3 
     4 #------------------------------------------------------------------------------#
     5 # Makefile to build libEtpan GPGME, GnuPG and deps for use with pEpEngine 
     6 #  based on pEpJNIAdapter/android/external/Makefile
     7 #------------------------------------------------------------------------------#
     8 
     9 all: build 
    10 
    11 build: libetpan-install gnupg-install gpgme-install
    12 
    13 PREFIX ?= $(HOME)
    14 
    15 CFLAGS = 
    16 LDFLAGS = 
    17 
    18 #------------------------------------------------------------------------------#
    19 # libgpg-error
    20 
    21 EXTERNAL_GIT_REPOS += libgpg-error|git://git.gnupg.org/libgpg-error.git?libgpg-error-1.20
    22 
    23 libgpg-error/configure: libgpg-error.src.stamp libgpg-error/configure.ac 
    24 	cd libgpg-error && ./autogen.sh
    25 
    26 libgpg-error/Makefile: libgpg-error/configure 
    27 	cd libgpg-error && \
    28 		./configure \
    29 			CFLAGS="$(CFLAGS)" \
    30 			LDFLAGS="$(LDFLAGS)" \
    31 			--disable-doc \
    32 			--disable-languages \
    33 			--prefix=$(PREFIX)
    34 	ls -l libgpg-error/libtool
    35 
    36 libgpg-error/src/.libs/libgpg-error.so: libgpg-error/Makefile 
    37 	$(MAKE) -C libgpg-error
    38 
    39 libgpg-error-build: libgpg-error/src/.libs/libgpg-error.so
    40 
    41 $(PREFIX)/lib/libgpg-error.so: libgpg-error/src/.libs/libgpg-error.so
    42 	$(MAKE) -C libgpg-error prefix=$(PREFIX) install
    43 	ls -l $(PREFIX)/lib/libgpg-error.so*
    44 
    45 libgpg-error-install: $(PREFIX)/lib/libgpg-error.so
    46 
    47 #------------------------------------------------------------------------------#
    48 # libgcrypt
    49 
    50 EXTERNAL_GIT_REPOS += libgcrypt|git://git.gnupg.org/libgcrypt.git?libgcrypt-1.6.4
    51 
    52 libgcrypt/configure: libgcrypt.src.stamp libgcrypt/configure.ac 
    53 	cd libgcrypt && ./autogen.sh
    54 
    55 libgcrypt/Makefile: libgcrypt/configure 
    56 	cd libgcrypt && \
    57 		CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
    58 			./configure \
    59 				--enable-maintainer-mode \
    60 				--with-gpg-error-prefix=$(PREFIX) \
    61 				--prefix=$(PREFIX)
    62 
    63 libgcrypt/src/.libs/libgcrypt.so: $(PREFIX)/lib/libgpg-error.so libgcrypt/Makefile
    64 	$(MAKE) -C libgcrypt
    65 
    66 $(PREFIX)/lib/libgcrypt.so: libgcrypt/src/.libs/libgcrypt.so
    67 	$(MAKE) -C libgcrypt prefix=$(PREFIX) install
    68 	ls -l $(PREFIX)/lib/libgcrypt.so
    69 
    70 libgcrypt-build: libgcrypt/src/.libs/libgcrypt.so
    71 
    72 libgcrypt-install: $(PREFIX)/lib/libgcrypt.so
    73 
    74 #------------------------------------------------------------------------------#
    75 # libassuan
    76 
    77 EXTERNAL_GIT_REPOS += libassuan|git://git.gnupg.org/libassuan.git?libassuan-2.3.0
    78 
    79 libassuan/configure: libassuan.src.stamp libassuan/configure.ac 
    80 	cd libassuan && ./autogen.sh && autoreconf --install --force --verbose
    81 
    82 libassuan/Makefile: libassuan/configure
    83 	cd libassuan && \
    84 		CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
    85 			./configure \
    86 				--enable-maintainer-mode \
    87 				--with-gpg-error-prefix=$(PREFIX) \
    88 				--prefix=$(PREFIX)
    89 
    90 libassuan/src/.libs/libassuan.so: $(PREFIX)/lib/libgpg-error.so libassuan/Makefile
    91 	$(MAKE) -C libassuan
    92 
    93 $(PREFIX)/lib/libassuan.so: libassuan/src/.libs/libassuan.so
    94 	$(MAKE) -C libassuan prefix=$(PREFIX) install
    95 	ls -l $(PREFIX)/lib/libassuan.so
    96 
    97 libassuan-build: libassuan/src/.libs/libassuan.so
    98 
    99 libassuan-install: $(PREFIX)/lib/libassuan.so
   100 
   101 #------------------------------------------------------------------------------#
   102 # libksba
   103 
   104 EXTERNAL_GIT_REPOS += libksba|git://git.gnupg.org/libksba.git?libksba-1.3.3
   105 
   106 libksba/configure: libksba.src.stamp libksba/configure.ac 
   107 	cd libksba && ./autogen.sh
   108 
   109 libksba/Makefile: $(PREFIX)/lib/libgpg-error.so libksba/configure
   110 	cd libksba && \
   111 		CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
   112 			./configure \
   113 				--enable-maintainer-mode \
   114 				--with-gpg-error-prefix=$(PREFIX) \
   115 				--prefix=$(PREFIX)
   116 
   117 libksba/src/.libs/libksba.so: libksba/Makefile
   118 	$(MAKE) -C libksba
   119 
   120 $(PREFIX)/lib/libksba.so: libksba/src/.libs/libksba.so
   121 	$(MAKE) -C libksba prefix=$(PREFIX) install
   122 	ls -l $(PREFIX)/lib/libksba.so
   123 
   124 libksba-build: libksba/src/.libs/libksba.so
   125 
   126 libksba-install: $(PREFIX)/lib/libksba.so
   127 
   128 #------------------------------------------------------------------------------#
   129 # curl
   130 
   131 EXTERNAL_GIT_REPOS += curl|https://github.com/bagder/curl?curl-7_45_0
   132 
   133 curl/configure: curl.src.stamp curl/configure.ac 
   134 	cd curl && ./buildconf
   135 
   136 curl/Makefile: curl/configure
   137 	cd curl && \
   138 		CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
   139 			./configure \
   140 				--prefix=$(PREFIX) \
   141 				--with-gnu-ld \
   142 				--disable-imap \
   143 				--disable-ldap \
   144 				--disable-pop3 \
   145 				--disable-rtsp \
   146 				--disable-smtp
   147 
   148 curl/lib/.libs/libcurl.so: curl/Makefile
   149 	$(MAKE) -C curl
   150 
   151 $(PREFIX)/lib/libcurl.so: curl/lib/.libs/libcurl.so
   152 	$(MAKE) -C curl prefix=$(PREFIX) install
   153 	ls -l $(PREFIX)/lib/libcurl.so
   154 
   155 curl-build: curl/lib/.libs/libcurl.so
   156 
   157 curl-install: $(PREFIX)/lib/libcurl.so
   158 
   159 
   160 #------------------------------------------------------------------------------#
   161 # gnupg
   162 
   163 EXTERNAL_GIT_REPOS += gnupg|git://git.gnupg.org/gnupg.git?gnupg-2.0.29
   164 
   165 gnupg/configure: gnupg.src.stamp gnupg/configure.ac 
   166 	-sed -i '/^tests/d' gnupg/configure.ac
   167 	-sed -i 's/tests = tests/tests =/' gnupg/Makefile.am
   168 	cd gnupg && ./autogen.sh
   169 
   170 gnupg/Makefile: gnupg/configure
   171 	cd gnupg && \
   172 		CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
   173 			./configure \
   174 				--enable-maintainer-mode \
   175 				--with-gpg-error-prefix=$(PREFIX) \
   176 				--with-libgcrypt-prefix=$(PREFIX) \
   177 				--with-libassuan-prefix=$(PREFIX) \
   178 				--with-ksba-prefix=$(PREFIX) \
   179 				--with-libcurl=$(PREFIX) \
   180 				--disable-agent \
   181 				--disable-scdaemon \
   182 				--disable-ldap \
   183 				--disable-doc \
   184 				--disable-gpgsm \
   185 				--prefix=$(PREFIX)
   186 
   187 gnupg/g10/gpg2: $(PREFIX)/lib/libgpg-error.so $(PREFIX)/lib/libgcrypt.so $(PREFIX)/lib/libksba.so $(PREFIX)/lib/libassuan.so $(PREFIX)/lib/libcurl.so gnupg/Makefile
   188 	$(MAKE) -C gnupg
   189 
   190 $(PREFIX)/bin/gpg2: gnupg/g10/gpg2 gnupg/configure
   191 	$(MAKE) -C gnupg prefix=$(PREFIX) install
   192 	ls -l $(PREFIX)/bin/gpg2
   193 
   194 gnupg-build: gnupg/g10/gpg2
   195 
   196 gnupg-install: $(PREFIX)/bin/gpg2
   197 
   198 #------------------------------------------------------------------------------#
   199 # gpgme
   200 
   201 EXTERNAL_GIT_REPOS += gpgme|git://git.gnupg.org/gpgme.git?gpgme-1.6.0
   202 
   203 gpgme/configure: gpgme.src.stamp gpgme/configure.ac 
   204 	cd gpgme && ./autogen.sh 
   205 
   206 gpgme/Makefile: gpgme/configure
   207 	cd gpgme && \
   208 		CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
   209 			./configure \
   210 				--enable-maintainer-mode \
   211 				--with-gpg-error-prefix=$(PREFIX) \
   212 				--with-libassuan-prefix=$(PREFIX) \
   213 				--enable-fixed-path=$(PREFIX)/bin \
   214 				--without-g13 \
   215 				--disable-glibtest \
   216 				--disable-gpg-test \
   217 				--disable-gpgsm-test \
   218 				--disable-gpgconf-test \
   219 				--disable-parallel-test \
   220 				--disable-g13-test \
   221 				--prefix=$(PREFIX)
   222 
   223 
   224 gpgme/src/.libs/libgpgme.so: gpgme/Makefile
   225 	$(MAKE) -C gpgme
   226 
   227 $(PREFIX)/lib/libgpgme.so: gpgme/src/.libs/libgpgme.so
   228 	$(MAKE) -C gpgme prefix=$(PREFIX) install
   229 
   230 gpgme-build: gpgme/src/.libs/libgpgme.so
   231 
   232 gpgme-install: $(PREFIX)/bin/gpg2 $(PREFIX)/lib/libgpgme.so
   233 
   234 #------------------------------------------------------------------------------#
   235 # libetpan
   236 
   237 EXTERNAL_GIT_REPOS += libetpan|https://github.com/fdik/libetpan.git?HEAD
   238 
   239 libetpan/configure: libetpan.src.stamp
   240 	cd libetpan && ./autogen.sh
   241 
   242 libetpan/Makefile: libetpan/configure
   243 	cd libetpan && \
   244 		CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
   245 			./configure \
   246 				--prefix=$(PREFIX)
   247 
   248 libetpan/src/.libs/libetpan.so: libetpan/Makefile
   249 	$(MAKE) -C libetpan
   250 
   251 $(PREFIX)/lib/libetpan.so: libetpan/src/.libs/libetpan.so
   252 	$(MAKE) -C libetpan install
   253 
   254 libetpan-build: libetpan/src/.libs/libetpan.so
   255 
   256 libetpan-install: $(PREFIX)/lib/libetpan.so
   257 
   258 #------------------------------------------------------------------------------#
   259 # Clone update and archive external projects GIT repos
   260 # Local clone is in external/$project.git while 
   261 # selected commit is archived in external/$project
   262 
   263 define per_repo_targets
   264 $(1).git.stamp:
   265 	git clone $(2) $(1).git
   266 	touch $(1).git.stamp
   267 
   268 $(1).git_update: $(1).git.stamp
   269 	cd $(1).git; git pull
   270 	touch $(1).git.stamp
   271 
   272 $(1).src.stamp: $(1).git.stamp
   273 	rm -rf $(1)
   274 	mkdir $(1)
   275 	(cd $(1).git; git archive --format=tar $(3)) | tar -C $(1) -x
   276 	touch $(1).src.stamp
   277 
   278 $(1)-src: $(1).src.stamp
   279 
   280 $(1)-clean: 
   281 	rm -rf $(1)
   282 	rm -f $(1).src.stamp
   283 
   284 EXTERNAL_LOCAL_GITS += $(1).git.stamp
   285 EXTERNAL_LOCAL_GITS_UPDATE += $(1).git_update
   286 EXTERNAL_SRCS += $(1)-src
   287 EXTERNAL_SRCS_CLEAN += $(1)-clean
   288 endef
   289 
   290 define per_repo
   291 $(call per_repo_targets,\
   292     $(1),\
   293     $(word 1,$(subst ?, ,$(2))),\
   294     $(word 2,$(subst ?, ,$(2))))
   295 endef
   296 
   297 $(foreach repo, $(EXTERNAL_GIT_REPOS), $(eval $(call per_repo,\
   298     $(word 1,$(subst |, ,$(repo))),\
   299     $(word 2,$(subst |, ,$(repo))))))
   300 
   301 git_clones: $(EXTERNAL_LOCAL_GITS)
   302 
   303 git_update: $(EXTERNAL_LOCAL_GITS_UPDATE)
   304 
   305 #------------------------------------------------------------------------------#
   306 # clean
   307 
   308 clean: $(EXTERNAL_SRCS_CLEAN) clean-install libetpan-cleanzip
   309 
   310 #------------------------------------------------------------------------------#
   311 
   312 .PHONY = clean clean-install libetpan-cleanzip\
   313 	libgpg-error-build libgpg-error-install \
   314 	libgcrypt-build libgcrypt-install \
   315 	libassuan-build libassuan-install \
   316 	libksba-build libksba-install \
   317 	gnupg-build  gnupg-install\
   318 	gpgme-build  gpgme-install\
   319 	curl-build curl-install \
   320 	clean-install \
   321     $(EXTERNAL_LOCAL_GITS_UPDATE) $(EXTERNAL_SRCS) $(EXTERNAL_SRCS_CLEAN) \
   322 	showsetup
   323