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