1 include $(top_srcdir)/setup-variables.am
2 include $(top_srcdir)/autotroll.am
3 include $(top_srcdir)/build/build.am
5 AUTOMAKE_OPTIONS = subdir-objects
7 ## Process this file with automake to produce Makefile.in
9 ACLOCAL_AMFLAGS = -I m4 -I m4-repo ${ACLOCAL_FLAGS}
12 SUBDIRS += $(SYNTHESIS_SUBDIR)
14 SUBDIRS += $(SYNTHESIS_SUBDIR_INCLUDES)
19 # choose D-Bus implementation
21 gdbus_dir = $(top_srcdir)/src/gdbusxx
22 gdbus_build_dir = src/gdbusxx
24 gdbus_dir = $(top_srcdir)/src/gdbus
25 gdbus_build_dir = src/gdbus
36 disted_docs += README NEWS COPYING $(TEST_README_FILES) test/syncevo-http-server-logging.conf
37 distbin_docs += $(disted_docs)
38 dist_doc_DATA += $(disted_docs)
40 distbin_docs += README.html
41 # do not distribute in tarball.
42 doc_DATA += README.html
45 man_MANS += syncevolution.1
60 MAINTAINERCLEANFILES += Makefile.in config.h.in config.guess config.sub configure depcomp install-sh ltmain.sh missing mkinstalldirs
62 TEST_README_FILES = $(wildcard $(top_srcdir)/test/README.*)
64 # files and file patterns which are not meant to be packaged.
65 DEV_FILE_PATTERN = $(1)$(2)/include $(1)$(2)/lib/*.so $(1)$(2)/lib/*.a $(1)$(2)/lib/*.la $(1)$(2)/lib/*/*.la $(1)$(2)/lib/pkgconfig
67 # Exclude syncactivesync.so from bundle package because that needs to
68 # be packaged separately.
69 DEV_FILE_PATTERN += $(1)$(2)/lib/syncevolution/backends/syncactivesync.so
71 # binary distribution as .tar.gz
73 # when building with D-Bus, we have no choice: the service has to go into /usr
74 # in order to be found
75 distbin : $(distbin_docs) INSTALL-tar-gz all
76 @ [ "$(BINSUFFIX)" ] || (echo "please invoke with e.g. 'make distbin BINSUFFIX=debian-3.1'"; exit 1 )
77 @ [ "$(prefix)" = "/usr" ] || (echo "please reconfigure with --prefix=/usr"; exit 1 )
79 $(MAKE) DESTDIR=`pwd`/$(distdir) install
80 $(MAKE) DESTDIR=`pwd`/$(distdir) installcheck
81 rm -rf $(call DEV_FILE_PATTERN,$(distdir),/usr)
82 for i in `find $(distdir) -type d | sort -r`; do rmdir $$i 2>/dev/null || true; done
83 mkdir -p $(distdir)/usr/share/doc/syncevolution
84 cp $(srcdir)/INSTALL-tar-gz $(distdir)/INSTALL
85 cp $(filter-out all, $+) $(distdir)/usr/share/doc/syncevolution
86 tar zcf $(distdir)-$(BINSUFFIX).tar.gz $(distdir)
89 # without D-Bus, we can simply create an archive with a bin directory
90 # and everything works
91 distbin : $(distbin_docs) all
92 @ [ "$(BINSUFFIX)" ] || (echo "please invoke with e.g. 'make distbin BINSUFFIX=debian-3.1'"; exit 1 )
94 $(MAKE) prefix=`pwd`/$(distdir) install
95 @echo removing developer files and empty directories
96 rm -rf $(call DEV_FILE_PATTERN,$(distdir),/)
97 for i in `find $(distdir) -type d | sort -r`; do rmdir $$i 2>/dev/null || true; done
98 cp $(filter-out all, $+) $(distdir)
99 tar zcf $(distdir)-$(BINSUFFIX).tar.gz $(distdir)
103 iphone : SyncEvolution.plist
105 IPHONE_FILENAME = syncevolution-$(VERSION)-iphone.zip
107 SyncEvolution.plist : SyncEvolution.plist.in $(IPHONE_FILENAME)
108 $(AM_V_GEN)sed -e 's/__FILENAME__/$(IPHONE_FILENAME)/' \
109 -e 's/__VERSION__/$(VERSION)/' \
110 -e 's/__SIZE__/$(shell ls -l $(IPHONE_FILENAME) | sed -e 's/ */ /g' | cut -d ' ' -f 5)/' \
113 $(IPHONE_FILENAME) : all
114 rm -rf syncevolution-iphone $@
115 $(MAKE) DESTDIR=`pwd`/syncevolution-iphone install
116 rm -rf `ls -1 -d syncevolution-iphone/usr/share/doc/syncevolution/*/spds/sources/* | grep -v addressbook`
117 perl -pi -e 's;SyncEvolution test #1;;;' \
118 -e 's;^type = text/(x-)?vcard;type = addressbook;m;' \
119 syncevolution-iphone/usr/share/doc/syncevolution/*/spds/sources/addressbook/config.txt
120 cd syncevolution-iphone && zip -r ../$(IPHONE_FILENAME) .
124 # Dependency calculation is intentionally incomplete:
125 # - don't force dependency on specific EDS libs via backends, their versions change too much (handled via --enable-evolution-compatibility and dynamic loading of the backends)
126 # - ignore client-test dependencies (because users typically don't run it)
127 # - ignore backend dependencies (should never prevent installing the bundle)
128 # - be more flexible about kdelibs5 than dpkg-shlibdeps: it is found as package
129 # for libkdeui.so.5 and libkdecore.so.5 on Ubuntu Lucid, but after Debian
130 # Squeeze the package was replaced by individual library packages. On such
131 # distros, libkdeui5 is what we need.
132 # - same for kdepimlibs5 -> libakonadi-kde4
133 # - kdebase-runtime became kde-runtime in Debian Wheezy
134 REQUIRES_SED_KDE = -e 's/kdelibs5 ([^,]*),/kdelibs5 | libkdeui5,/g' -e 's/kdepimlibs5 ([^,]*),/kdepimlibs5 | libakonadi-kde4,/g' -e 's/kdebase-runtime/kdebase-runtime | kde-runtime/g'
135 REQUIRES_deb = --requires="'$(shell set -x; cd checkinstall/dist; LD_LIBRARY_PATH=$(distdir)/usr/lib:$(distdir)/usr/lib/syncevolution dpkg-shlibdeps -L$(srcdir)/src/shlibs.local --ignore-missing-info -O $$(for i in $$(find $(distdir) -type f -perm /u+x | grep -v -e client-test -e lib/syncevolution/backends/); do if file $$i | grep ELF >/dev/null; then echo $$i; fi; done) | sed $(REQUIRES_SED_KDE) -e 's/[^=]*=//')$(REQUIRES_deb_neon)$(REQUIRES_deb_ical)'"
136 if NEON_COMPATIBILITY
137 # --enable-neon-compatibility in src/backends/webdav:
138 # replace dependencies from linking with hard-coded dlopen() dependencies
139 REQUIRES_deb_neon = , libneon27 (>= 0.29.0) | libneon27-gnutls (>= 0.29.0)
144 REQUIRES_deb_ical = , libical0 | libical1
146 VERSION_deb = 1:$(STABLE_VERSION)$(VERSION)
147 VERSION_rpm = `echo $(VERSION) | sed -e s/-/_/g`
150 # The package name: BINSUFFIX is used to distinguish binaries
151 # for different Evolution releases.
152 PKGNAME=syncevolution$(patsubst %,-%,$(BINSUFFIX))
154 # This is a list of packages (potentially) provided on estamos.de.
155 # The current package conflicts with any of them, but not itself.
156 PKGS = $(addprefix syncevolution-evolution-, 2.6 2.8 2.12)
158 # When calling checkinstall we cannot install into /tmp
159 # because any file created there will be excluded: that makes
160 # sense, because "make install" might create temporary files
161 # there. The current directory might be in /tmp, so use $HOME.
163 # --replaces is necessary for migrating from syncevolution-evolution-<evover>
164 # to syncevolution-evolution (as per http://wiki.debian.org/Renaming_a_Package)
166 # When we build shared objects, then conflict with the corresponding
167 # system libs. The assumption is that the system library is named
168 # after the lib and its major version, which holds for libsmltk and
169 # libsynthesis in Debian.
170 deb rpm : checkinstall/dist/$(distdir) checkinstall/dist/debian/control
171 (echo "SyncEvolution - synchronizing personal information management data" && cat $(srcdir)/description) >checkinstall/description-pak
172 echo "/sbin/ldconfig" >checkinstall/postremove-pak
173 echo "/sbin/ldconfig" >checkinstall/postinstall-pak
174 conflicts=`ls -1 checkinstall/dist/$(distdir)/usr/lib/*.so.[0123456789] | sed -e 's;.*/;;' -e 's/\.so\.//' -e 's/$$/, /'` && \
175 tmpdir=`mktemp -d $$HOME/syncevolution.XXXXXXXXXX` && \
176 trap "rm -rf $$tmpdir" EXIT && \
178 fakeroot checkinstall </dev/null \
183 --pkgversion=$(VERSION_$@) \
184 --pkgrelease=$(RELEASE) \
185 --pkgname=$(PKGNAME) \
186 --pkgarch=$(PKGARCH) \
187 --provides=syncevolution \
188 --replaces="'syncevolution, `echo $(filter-out $(PKGNAME), $(PKGS)) | sed -e 's/ */ (<< 1:0.8.1-2), /g'` (<< 1:0.8.1-2)'" \
189 --conflicts="'$${conflicts}syncevolution, `echo $(filter-out $(PKGNAME), $(PKGS)) | sed -e 's/ */ (<< 1:0.8.1-2), /g'` (<< 1:0.8.1-2)', libsmltk0, libsyncevolution0, libsynthesis0, syncevolution-common, syncevolution-libs" \
190 --maintainer="'Patrick Ohly <patrick.ohly@gmx.de>'" \
191 --pkgsource='http://syncevolution.org' \
194 cp -r `pwd`/dist/$(distdir)/* / && \
195 if [ $@ = "rpm" ]; then cp /usr/src/rpm/RPMS/*/${PKGNAME}-${VERSION}-2.*.rpm ..; else mv ${PKGNAME}_${VERSION}*.deb ..; fi
197 # Pseudo platform .deb packages:
198 # only depend on PKGNAME = syncevolution-$(BINSUFFIX) (usually syncevolution-bundle).
199 # Version number is only bumped when changing the packaging rules here.
200 PLATFORM_DEB_VERSION = $(VERSION_deb)
201 PLATFORM_DEB_RELEASE = 1
203 deb : syncevolution-kde-deb
204 deb : syncevolution-evolution-deb
207 # define which files are relevant for each platform
208 PLATFORM_FILES_evolution = platformgnome syncecal syncebook
209 PLATFORM_FILES_kde = platformkde syncakonadi
211 # Additional parameters for syncevolution-kde/evolution.deb.
212 # Fake conflicts/replaces works around a bug in CheckInstall,
213 # which creates empty, invalid entries for those unless
214 # something is given. For Evolution we hard-code dependencies
215 # (because with EDS compatibility turned on, several
216 # alternatives will work at runtime) and conflict with
217 # EDS 3.6, because that breaks the API and does not work for us
219 SYNCEVOLUTION_kde_DEB_ARGS = \
220 --conflicts=syncevolution-foobar \
221 --replaces=syncevolution-foobar
222 SYNCEVOLUTION_evolution_DEB_ARGS = \
223 --conflicts=syncevolution-foobar \
224 --replaces=syncevolution-foobar
225 SYNCEVOLUTION_evolution_DEB_REQUIRES = \
226 , libebook1.2-5 | libebook1.2-6 | libebook1.2-7 | libebook1.2-8 | libebook1.2-9 | libebook1.2-10 | libebook1.2-11 | libebook-1.2-11 | libebook-1.2-12 | libebook-1.2-13 $(EXTRA_BACKENDS_EBOOK_REQUIRES) \
227 , libecal1.2-3 | libecal1.2-4 | libecal1.2-5 | libecal1.2-6 | libecal1.2-7 | libecal1.2-8 | libecal1.2-9 | libecal1.2-10 | libecal-1.2-10 | libecal-1.2-11 $(EXTRA_BACKENDS_ECAL_REQUIRES)
229 syncevolution-%-deb: checkinstall/dist/$(distdir) checkinstall/dist/debian/control
230 (echo "SyncEvolution - meta package for $*" && cat $(srcdir)/description) >checkinstall/description-pak
231 tmpdir=`mktemp -d $$HOME/syncevolution.XXXXXXXXXX` && \
232 trap "rm -rf $$tmpdir" EXIT && \
234 fakeroot checkinstall </dev/null \
239 --pkgversion=$(PLATFORM_DEB_VERSION) \
240 --pkgrelease=$(PLATFORM_DEB_RELEASE) \
241 $(SYNCEVOLUTION_$*_DEB_ARGS) \
242 --pkgname=syncevolution-$* \
244 --requires="'$(shell set -x; cd checkinstall/dist; LD_LIBRARY_PATH=$(distdir)/usr/lib:$(distdir)/usr/lib/syncevolution dpkg-shlibdeps -L$(srcdir)/src/shlibs.local --ignore-missing-info -O $$(for i in $(patsubst %,$(distdir)/usr/lib/syncevolution/backends/%.so,$(PLATFORM_FILES_$*)); do if file $$i | grep ELF >/dev/null; then echo $$i; fi; done) | sed $(REQUIRES_SED_KDE) -e 's/[^=]*=//'), $(PKGNAME) (= $(VERSION_deb)-$(RELEASE))$(SYNCEVOLUTION_$*_DEB_REQUIRES)'" \
245 --maintainer="'Patrick Ohly <patrick.ohly@gmx.de>'" \
246 --pkgsource='http://syncevolution.org' \
248 sh -c 'mkdir -p touch /usr/share/doc/syncevolution-$* && echo "SyncEvolution platform pseudo-package for $*" >/usr/share/doc/syncevolution-$*/README' && \
249 mv syncevolution-$**.deb ..
251 all_phonies += checkinstall/dist/$(distdir) clean_dist
252 checkinstall/dist/$(distdir): all
254 $(MAKE) install DESTDIR=`pwd`/$@
255 $(MAKE) installcheck DESTDIR=`pwd`/$@
256 rm -rf $(call DEV_FILE_PATTERN,$@,/usr)
257 clean-local: clean_dist
261 # required by dpkg-shlibdeps
262 checkinstall/dist/debian/control:
266 # Build "html" inside the build dir, using source files
267 # from the SyncEvolution source directory and (if built)
268 # the installed client-api.build directory.
269 all_phonies += doc clean-html
272 export VERSION="SyncEvolution $(VERSION)"; \
273 export OUTPUT_DIRECTORY="`pwd`"; \
274 export PREDEFINED="@BACKEND_DEFINES@ ENABLE_UNIT_TESTS ENABLE_INTEGRATION_TESTS"; \
275 export CLIENT_LIBRARY="@FUNAMBOL_SUBDIR@/test @FUNAMBOL_SUBDIR@/include "; \
276 export STRIP_FROM_PATH="$(srcdir) `dirname @FUNAMBOL_SUBDIR@`"; \
277 cd $(srcdir); doxygen
278 clean-local: clean-html
282 all_dist_hooks += dot_dist_hook
284 @if test -d "$(srcdir)/.git"; \
286 printf '%s' 'Creating ChangeLog...' && \
287 ( cd "$(top_srcdir)" && \
288 printf '%s\n\n' '# Generated by configure. Do not edit.'; \
289 $(top_srcdir)/missing --run perl $(top_srcdir)/build/gen-changelog.pl ) > ChangeLog.tmp && \
290 ( mv -f ChangeLog.tmp $(top_distdir)/ChangeLog && \
291 printf '%s\n' ' done.' ) || \
292 ( rm -f ChangeLog.tmp ; \
293 printf '%s\n' ' failed.'; \
294 echo Failed to generate ChangeLog >&2 ); \
296 echo 'A git checkout is required to generate a ChangeLog.' >&2; \
299 if ENABLE_EVOLUTION_COMPATIBILITY
300 # check .so (relevant for modular builds) and main syncevolution binary
301 # (relevant in that case and for static builds) for dependencies on
302 # problematic libraries and symbols
304 # Exclude *-[0-9].so, these are EXTRA_BACKENDS for which other rules apply.
306 # ical_strdup is an exception because it is in SyncEvolution.
307 all_local_installchecks += toplevel_so_check
309 for i in `find $(DESTDIR)/$(libdir)/syncevolution $(DESTDIR)/$(libdir)/libsyncevo* $(DESTDIR)/$(libdir)/libsynthesis* -name *.so | grep -v -e -[0-9].so` $(DESTDIR)/$(bindir)/syncevolution; \
311 if objdump -T -C $$i | grep -v :: | grep '\*UND\*' | sort | grep -v -w ical_strdup | grep -e ical -e " e_"; then \
312 echo "$$i should not depend on EDS, libical or libbluetooth"; \
315 if ldd $$i | grep -e libecal -e libebook -e libedata -e libical -e libbluetooth; then \
316 echo "$$i should not be linked against EDS, libical or libbluetooth"; \
322 # Check that no executable or shared object depends on symbols in
323 # libraries that it does not link against. Unnecessarily linking
324 # against libs is okay, that can be caught and fixed by
325 # -Wl,--as-needed. Depends on dpkg-shlibdeps, skipped if that is
327 all_local_installchecks += toplevel_link_check
329 set -x; cd $(DESTDIR) && \
331 touch debian/control && \
332 trap "rm -rf debian" EXIT && \
333 files=$$(find $(DESTDIR)/$(prefix) $(DESTDIR)/$(libdir) $(DESTDIR)/$(bindir) $(DESTDIR)/$(libexecdir) -type f -perm /u+x | sort -u) && \
334 files=$$(for i in $$files; do if file $$i | grep ELF >/dev/null; then echo $$i; fi; done) && \
335 if ! dpkg-shlibdeps --version; then \
336 echo "dpkg-shlibdeps not found, skipping link check"; \
337 elif LD_LIBRARY_PATH=usr/lib:usr/lib/syncevolution dpkg-shlibdeps \
338 --ignore-missing-info -O $$files \
340 grep -v $(LINK_CHECK_ALLOWED) | \
341 grep -e "symbol .* found in none of the libraries" \
342 -e "contains an unresolvable reference to symbol" \
344 echo "linking must be fixed"; false; \
346 echo "linking is okay"; \
349 # Some exceptions for the link check above (= symbol may be used without linking).
350 LINK_CHECK_ALLOWED = -e xxxxxxxx
351 # SySync_ConsolePrintf is expected by libsmltk and has to be provided by caller.
352 LINK_CHECK_ALLOWED += -e 'SySync_ConsolePrintf.*libsmltk.so'
353 if NEON_COMPATIBILITY
354 # libneon is intentionally not linked against, to choose between
355 # GNUTLS and OpenSSL at runtime.
356 LINK_CHECK_ALLOWED += -e 'symbol ne_.*syncdav.so'
357 # Allow undefined references to libstdcxx. This happens when
358 # adding backends compiled on more recent Linux distros into
359 # the release archive.
360 LINK_CHECK_ALLOWED += -e '@GLIBCXX_[^ ]* used by'
363 # Be strict about running 'syncevolution' only when not doing
364 # cross-compilation: in that case, if running 'syncevolution' fails,
365 # abort the build process. Otherwise proceed with the fallback below,
366 # which is to keep the "see --sync/source-property ?" placeholders in
368 if COND_CROSS_COMPILING
369 RUN_SYNCEVOLUTION_CHECK=if ($$?) { return ""; } else { return $$buffer; }
371 RUN_SYNCEVOLUTION_CHECK=die if $$?; return $$buffer;
374 # patch README.rst properties on-the-fly
375 README.patched.rst: README.rst src/syncevolution
376 $(AM_V_GEN)perl -e '$$syncfound=0; $$sourcefound=0; $$res=0;' \
377 -e 'sub run { $$cmd = shift; $$buffer = `env LD_LIBRARY_PATH=src/syncevo/.libs:src/gdbus/.libs:src/gdbusxx/.libs:src/build-synthesis/src/.libs:$$ENV{LD_LIBRARY_PATH} $$cmd`; $(RUN_SYNCEVOLUTION_CHECK) }' \
379 -e 's/^:Version: .*/:Version: $(VERSION)/;' \
380 -e 's/:Date: .*/":Date: " . `date +%Y-%m-%d`/e;' \
381 -e 'if (s;(<< see "syncevolution --sync-property ." >>\n);run("src/syncevolution --daemon=no --sync-property ?") || $$1;e) { $$syncfound=1; }' \
382 -e 'if (s;(<< see "syncevolution --datastore-property ." >>\n);run("src/syncevolution --daemon=no --source-property ?") || $$1;e) { $$sourcefound=1; }' \
385 -e 'die "<<sync-property>> tag not in README.rst?!" unless $$syncfound;' \
386 -e 'die "<<source-property>> tag not in README.rst?!" unless $$sourcefound;' \
389 CLEANFILES += README.patched.rst
392 syncevolution.1: README.patched.rst
393 $(AM_V_GEN)$(RST2MAN) --exit-status=3 $< >$@
394 CLEANFILES += syncevolution.1
396 # README is the traditional name in the distribution,
397 # continue using it instead of README.rst.
398 # TODO: replace some of the RST syntax
399 README: README.patched.rst
403 # The README.html is also used on syncevolution.org as "Usage" page,
404 # therefore we must use <h3> headers and lower to fit into the page.
405 README.html: README.patched.rst
406 $(AM_V_GEN)$(RST2HTML) --initial-header-level=3 --exit-status=3 $< >$@
407 CLEANFILES += README.html
409 .PHONY: $(all_phonies) ;
411 installcheck-local: $(all_local_installchecks) ;
413 dist-hook: $(all_dist_hooks)
414 install-exec-hook: $(all_install_exec_hooks)
415 uninstall-hook: $(all_uninstall_hooks)
417 # Force sequential installation. This is a workaround for relinking failures
418 # during concurrent distcheck (a backend was relinked against not yet installed
419 # libsyncevolution.la).
421 # Also used to add additional backends. EXTRA_BACKENDS must already contain
422 # renamed files, by convention using -2.so, -3.so, etc as suffix instead of the
425 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am
426 @$(MAKE) $(AM_MAKEFLAGS) install-data-am
427 for i in $(EXTRA_BACKENDS); do $(INSTALL) $$i $(DESTDIR)/$(BACKENDS_DIRECTORY)/; done
429 # Necessary for "make distcheck": must not leave files behind.
431 rm -f $(DESTDIR)/$(BACKENDS_DIRECTORY)/*-[0-9].so