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