Close ssl_sock before returning error in connect_https_socket()
[platform/upstream/openconnect.git] / Makefile.am
index c2d3452..7ab813c 100644 (file)
@@ -18,8 +18,11 @@ openconnect_CFLAGS = $(SSL_CFLAGS) $(DTLS_SSL_CFLAGS) $(LIBXML2_CFLAGS) $(LIBPRO
 openconnect_LDADD = libopenconnect.la $(SSL_LIBS) $(DTLS_SSL_LIBS) $(LIBXML2_LIBS) $(LIBPROXY_LIBS) $(ZLIB_LIBS) $(LIBINTL)
 
 library_srcs = ssl.c http.c auth.c library.c compat.c
-lib_srcs_gnutls = gnutls.c gnutls_pkcs12.c
+lib_srcs_gnutls = gnutls.c gnutls_pkcs12.c gnutls_tpm.c
 lib_srcs_openssl = openssl.c
+
+POTFILES = $(openconnect_SOURCES) $(lib_srcs_openssl) $(lib_srcs_gnutls) $(library_srcs)
+
 if OPENCONNECT_GNUTLS
 library_srcs += $(lib_srcs_gnutls)
 endif
@@ -30,7 +33,7 @@ libopenconnect_la_SOURCES = version.c $(library_srcs)
 libopenconnect_la_CFLAGS = $(SSL_CFLAGS) $(LIBXML2_CFLAGS) $(LIBPROXY_CFLAGS) $(P11KIT_CFLAGS) $(TSS_CFLAGS)
 libopenconnect_la_LIBADD = $(SSL_LIBS) $(LIBXML2_LIBS) $(LIBPROXY_LIBS) $(LIBINTL) $(P11KIT_LIBS) $(TSS_LIBS)
 libopenconnect_la_LDFLAGS = -version-number @APIMAJOR@:@APIMINOR@
-noinst_HEADERS = openconnect-internal.h openconnect.h
+noinst_HEADERS = openconnect-internal.h openconnect.h gnutls.h
 include_HEADERS = openconnect.h
 if HAVE_SYMBOL_VERSIONING
 libopenconnect_la_LDFLAGS += -Wl,@VERSION_SCRIPT_ARG@,libopenconnect.map
@@ -39,7 +42,7 @@ endif
 
 pkgconfig_DATA = openconnect.pc
 
-EXTRA_DIST = version.sh COPYING.LGPL $(lib_srcs_openssl) $(lib_srcs_gnutls)
+EXTRA_DIST = version.sh COPYING.LGPL $(lib_srcs_openssl) $(lib_srcs_gnutls) Android.mk
 
 DISTCLEANFILES = $(pkgconfig_DATA)
 
@@ -98,14 +101,52 @@ tag: uncommitted-check
        @git tag v$(VERSION)
        @cd $(srcdir) && ./autogen.sh
 
-update-translations:
+update-translations: po/$(PACKAGE).pot
        @cd $(top_srcdir); if ! git diff-index --name-only --exit-code HEAD -- po/; then \
                echo "*** ERROR: Uncommitted changes in above files"; exit 1; \
        else \
-               tx pull -af ; git commit -s -m "Update translations from Transifex" -- po/ ; \
+               for a in po/*.po; do \
+                       msgmerge -q -N -F $$a $(abs_builddir)/po/$(PACKAGE).pot | sed '0,/^#:/d' > $$a.old ; \
+               done && \
+               tx pull -af && \
+               for a in po/*.po; do \
+                       msgmerge -q -N -F $$a $(abs_builddir)/po/$(PACKAGE).pot > $$a.new ; \
+                       sed '0,/^#:/d' $$a.new > $$a.new.cmp ; \
+                       if ! git ls-tree --name-only HEAD $$a | grep -q $$a; then \
+                               echo New file $$a ; \
+                               git add $$a ; \
+                       elif ! diff -u $$a.old $$a.new.cmp; then \
+                               echo New changes for $$a; \
+                               mv $$a.new $$a; \
+                       else \
+                               git checkout -f HEAD $$a ; \
+                       fi ; \
+                       rm -f $$a.old $$a.new $$a.new.cmp ; \
+               done && \
+               ls po/*.po | sed 's%^po/\(.*\)\.po%\1%' > po/LINGUAS ; \
+               if ! git update-index -q --refresh --unmerged || \
+                  ! git diff-index --name-only --exit-code HEAD -- po/ >/dev/null; then \
+                       git commit -s -m "Update translations from Transifex" -- po/ ; \
+               else \
+                       echo No changes to commit ; \
+               fi ; \
        fi
 
-upload-pot:
-       if [ ${abs_top_builddir} != $(abs_top_srcdir) ]; then \
+upload-pot: po/$(PACKAGE).pot
+       @if [ ${abs_top_builddir} != $(abs_top_srcdir) ]; then \
                ln -sf ${abs_top_srcdir}/.tx .tx; fi
-       @make -C po openconnect.pot && tx push -s
+       @tx push -s
+
+po/$(PACKAGE).pot: $(POTFILES) Makefile
+       @echo "Regenerating $@" ; rm -f $@ && \
+       xgettext --directory=$(top_srcdir) --from-code=UTF-8 \
+         --add-comments --keyword=_ --keyword=N_ \
+         --package-name="@PACKAGE@" --package-version="@VERSION@" \
+         --msgid-bugs-address=openconnect-devel@lists.infradead.org \
+         -o $@ $(POTFILES)
+
+Android.mk: Makefile.am
+       @for a in openconnect_SOURCES library_srcs lib_srcs_openssl noinst_HEADERS; do \
+               FILES=`grep "^$$a = " $(top_srcdir)/Makefile.am`; \
+               sed "s/^$$a = .*/$$FILES/" -i $(top_srcdir)/Android.mk;  \
+       done