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