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