[vlc-commits] update: use Makefile conditional to disable code
Rémi Denis-Courmont
git at videolan.org
Sun Jan 29 09:44:12 CET 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jan 29 10:27:59 2017 +0200| [6aa1a7add70b7fe64aa6816db640d0510770e5cb] | committer: Rémi Denis-Courmont
update: use Makefile conditional to disable code
This fixes the build without gcrypt.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6aa1a7add70b7fe64aa6816db640d0510770e5cb
---
configure.ac | 4 +---
include/vlc_update.h | 4 ----
modules/gui/qt/Makefile.am | 4 ++++
src/Makefile.am | 11 ++++++++---
src/misc/update.c | 39 ---------------------------------------
src/misc/update_crypto.c | 4 ----
src/missing.c | 40 ++++++++++++++++++++++++++++++++++++++++
test/Makefile.am | 7 ++++---
test/src/crypto/update.c | 10 ----------
9 files changed, 57 insertions(+), 66 deletions(-)
diff --git a/configure.ac b/configure.ac
index be5bf19..7050091 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4107,10 +4107,8 @@ if test "${enable_update_check}" = "yes"
then
AS_IF([test "${ac_cv_lib_gcrypt}" != "yes"],[
AC_MSG_ERROR([libgcrypt is required for update checking system]) ])
- VLC_ADD_LIBS([libvlccore], [${GCRYPT_LIBS}])
- VLC_ADD_CFLAGS([libvlccore], [${GCRYPT_CFLAGS}])
- AC_DEFINE([UPDATE_CHECK], 1, [Define if you want to use the VLC update mechanism])
fi
+AM_CONDITIONAL(UPDATE_CHECK, [test "${enable_update_check}" = "yes"])
dnl
dnl OS X notification plugin
diff --git a/include/vlc_update.h b/include/vlc_update.h
index df74405..8482b4f 100644
--- a/include/vlc_update.h
+++ b/include/vlc_update.h
@@ -34,8 +34,6 @@
*VLC software update interface
*/
-#ifdef UPDATE_CHECK
-
/**
* Describes an update VLC release number
*/
@@ -49,8 +47,6 @@ struct update_release_t
char* psz_desc; ///< Release description
};
-#endif /* UPDATE_CHECK */
-
typedef struct update_release_t update_release_t;
VLC_API update_t * update_New( vlc_object_t * );
diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 7e5f5ae..21bce05 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -14,6 +14,7 @@ guidir = $(pluginsdir)/gui
SUFFIXES += .ui .h .hpp .moc.cpp
+libqt_plugin_la_CPPFLAGS = $(AM_CPPFLAGS)
libqt_plugin_la_CXXFLAGS = $(AM_CXXFLAGS) $(QT_CFLAGS) $(CXXFLAGS_qt)
libqt_plugin_la_LIBADD = $(QT_LIBS) $(LIBS_qt) $(LIBM)
libqt_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(guidir)'
@@ -31,6 +32,9 @@ endif
if HAVE_WIN32
libqt_plugin_la_LIBADD += $(LIBCOM) -lcomctl32 -luuid
endif
+if UPDATE_CHECK
+libqt_plugin_la_CPPFLAGS += -DUPDATE_CHECK=1
+endif
gui_LTLIBRARIES = $(LTLIBqt)
EXTRA_LTLIBRARIES = libqt_plugin.la
diff --git a/src/Makefile.am b/src/Makefile.am
index ee676f9..59d88d7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -339,9 +339,6 @@ libvlccore_la_SOURCES = \
misc/variables.h \
misc/variables.c \
misc/error.c \
- misc/update.h \
- misc/update.c \
- misc/update_crypto.c \
misc/xml.c \
misc/addons.c \
misc/filter.c \
@@ -442,6 +439,14 @@ libvlccore_la_SOURCES += input/vlm.c input/vlm_event.c input/vlmshell.c
endif
endif
+if UPDATE_CHECK
+libvlccore_la_SOURCES += \
+ misc/update.h misc/update.c \
+ misc/update_crypto.c
+AM_CFLAGS += $(GCRYPT_CFLAGS)
+libvlccore_la_LIBADD += $(GCRYPT_LIBS)
+endif
+
libvlccore_la_LDFLAGS = \
$(LDFLAGS_libvlccore) \
-no-undefined \
diff --git a/src/misc/update.c b/src/misc/update.c
index 46bf80c..d8e6ded 100644
--- a/src/misc/update.c
+++ b/src/misc/update.c
@@ -39,8 +39,6 @@
#include <vlc_common.h>
#include <vlc_update.h>
-#ifdef UPDATE_CHECK
-
#include <assert.h>
#include <vlc_pgpkey.h>
@@ -757,40 +755,3 @@ update_release_t *update_GetRelease( update_t *p_update )
{
return &p_update->release;
}
-
-#else
-#undef update_New
-update_t *update_New( vlc_object_t *p_this )
-{
- (void)p_this;
- return NULL;
-}
-
-void update_Delete( update_t *p_update )
-{
- (void)p_update;
-}
-
-void update_Check( update_t *p_update, void (*pf_callback)( void*, bool ),
- void *p_data )
-{
- (void)p_update; (void)pf_callback; (void)p_data;
-}
-
-bool update_NeedUpgrade( update_t *p_update )
-{
- (void)p_update;
- return false;
-}
-
-void update_Download( update_t *p_update, const char *psz_destdir )
-{
- (void)p_update; (void)psz_destdir;
-}
-
-update_release_t *update_GetRelease( update_t *p_update )
-{
- (void)p_update;
- return NULL;
-}
-#endif
diff --git a/src/misc/update_crypto.c b/src/misc/update_crypto.c
index 1184596..1ed6476 100644
--- a/src/misc/update_crypto.c
+++ b/src/misc/update_crypto.c
@@ -34,8 +34,6 @@
# include "config.h"
#endif
-#ifdef UPDATE_CHECK
-
#include <gcrypt.h>
#include <assert.h>
#include <limits.h>
@@ -1106,5 +1104,3 @@ int download_signature( vlc_object_t *p_this, signature_packet_t *p_sig,
return VLC_SUCCESS;
}
-
-#endif /* UPDATE_CHECK */
diff --git a/src/missing.c b/src/missing.c
index 692b9b5..1ff22e2 100644
--- a/src/missing.c
+++ b/src/missing.c
@@ -402,3 +402,43 @@ vlm_t *vlm_New (vlc_object_t *obj)
return NULL;
}
#endif /* !ENABLE_VLM */
+
+#ifndef UPDATE_CHECK
+# include <vlc_update.h>
+
+update_t *(update_New)(vlc_object_t *obj)
+{
+ (void) obj;
+ return NULL;
+}
+
+void update_Delete(update_t *u)
+{
+ (void) u;
+ vlc_assert_unreachable();
+}
+
+void update_Check(update_t *u, void (*cb)(void *, bool), void *opaque)
+{
+ (void) u; (void) cb; (void) opaque;
+ vlc_assert_unreachable();
+}
+
+bool update_NeedUpgrade(update_t *u)
+{
+ (void) u;
+ vlc_assert_unreachable();
+}
+
+void update_Download(update_t *u, const char *dir)
+{
+ (void) u; (void) dir;
+ vlc_assert_unreachable();
+}
+
+update_release_t *update_GetRelease(update_t *u)
+{
+ (void) u;
+ vlc_assert_unreachable();
+}
+#endif /* !UPDATE_CHECK */
diff --git a/test/Makefile.am b/test/Makefile.am
index e47430e..9f33aa6 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -23,7 +23,6 @@ check_PROGRAMS = \
test_libvlc_slaves \
test_src_config_chain \
test_src_misc_variables \
- test_src_crypto_update \
test_src_input_stream \
test_src_input_stream_fifo \
test_src_interface_dialog \
@@ -32,8 +31,10 @@ check_PROGRAMS = \
test_src_misc_keystore \
test_modules_packetizer_hxxx \
test_modules_keystore \
- test_modules_tls \
- $(NULL)
+ test_modules_tls
+if UPDATE_CHECK
+check_PROGRAMS += test_src_crypto_update
+endif
check_SCRIPTS = \
modules/lua/telnet.sh \
diff --git a/test/src/crypto/update.c b/test/src/crypto/update.c
index a1b3e79..ac7def9 100644
--- a/test/src/crypto/update.c
+++ b/test/src/crypto/update.c
@@ -24,15 +24,6 @@
#include <stdio.h>
-#ifndef UPDATE_CHECK
-int main(void)
-{
- fprintf(stderr, "Update checking disabled, not testing.\n");
- return 77;
-}
-
-#else
-
#include <vlc_common.h>
#include "../src/misc/update_crypto.c"
@@ -292,4 +283,3 @@ int main(void)
check(&key, &key2, status, &sig, key_longid, key_longid2);
}
-#endif
More information about the vlc-commits
mailing list