Skip to content
Browse files

Allow compiling without mysql dependency (--disable-mysql).

MySQL is heavy and sqlite is the better choice on embedded devices.
Disables also build of cmyth as it depends on mysql.
  • Loading branch information...
1 parent e7240d7 commit 2d79579adf92fbe53a1b5c148348bed7e5ba21d3 @Schischu Schischu committed with Cory Fields Jun 18, 2012
Showing with 57 additions and 13 deletions.
  1. +10 −2 Makefile.in
  2. +28 −9 configure.in
  3. +10 −1 xbmc/dbwrappers/Database.cpp
  4. +4 −1 xbmc/dbwrappers/mysqldataset.cpp
  5. +5 −0 xbmc/system.h
View
12 Makefile.in
@@ -141,13 +141,16 @@ endif
LIB_DIRS=\
lib/cximage-6.0 \
lib/libexif \
- lib/cmyth \
lib/libhdhomerun \
lib/libid3tag \
lib/libapetag \
lib/cpluff \
lib/xbmc-dll-symbols
+ifeq (@USE_MYSQL@,1)
+LIB_DIRS += lib/cmyth
+endif
+
SS_DIRS=
ifneq (@DISABLE_RSXS@,1)
SS_DIRS+= xbmc/screensavers/rsxs-0.9/xbmc
@@ -317,7 +320,12 @@ imagelib: dllloader
$(MAKE) -C lib/cximage-6.0
codecs: papcodecs dvdpcodecs
-libs: cmyth libhdhomerun libid3tag imagelib libexif system/libcpluff-@ARCH@.so
+
+libs: libhdhomerun libid3tag imagelib libexif system/libcpluff-@ARCH@.so
+ifeq (@USE_MYSQL@,1)
+libs += cmyth
+endif
+
externals: codecs libs visualizations screensavers
xcode_depends: \
View
37 configure.in
@@ -381,6 +381,12 @@ AC_ARG_ENABLE([asap-codec],
[use_asap=$enableval],
[use_asap=no])
+AC_ARG_ENABLE([mysql],
+ [AS_HELP_STRING([--disable-mysql],
+ [disable mysql])],
+ [use_mysql=$enableval],
+ [use_mysql=yes])
+
AC_ARG_ENABLE([webserver],
[AS_HELP_STRING([--disable-webserver],
[disable webserver])],
@@ -731,14 +737,17 @@ else
fi
# platform common libraries
-AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, "yes", "no")
-if test $MYSQL_CONFIG = "yes"; then
- INCLUDES="$INCLUDES `mysql_config --include`"
- MYSQL_LIBS=`mysql_config --libs`
- LIBS="$LIBS $MYSQL_LIBS"
- AC_SUBST(MYSQL_LIBS)
-else
- AC_MSG_ERROR($missing_program)
+if test "$use_mysql" = "yes"; then
+ AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, "yes", "no")
+ if test $MYSQL_CONFIG = "yes"; then
+ AC_DEFINE([HAVE_MYSQL],[1],["Define to 1 if you have the `mysql' library (-lmysqlclient)."])
+ INCLUDES="$INCLUDES `mysql_config --include`"
+ MYSQL_LIBS=`mysql_config --libs`
+ LIBS="$LIBS $MYSQL_LIBS"
+ AC_SUBST(MYSQL_LIBS)
+ else
+ AC_MSG_ERROR($missing_program)
+ fi
fi
AC_CHECK_HEADER([ass/ass.h],, AC_MSG_ERROR($missing_library))
AC_CHECK_HEADER([mpeg2dec/mpeg2.h],, AC_MSG_ERROR($missing_library))
@@ -777,7 +786,9 @@ AC_CHECK_LIB([lzo2], [main],, AC_MSG_ERROR($missing_library))
AC_CHECK_LIB([z], [main],, AC_MSG_ERROR($missing_library))
AC_CHECK_LIB([crypto], [main],, AC_MSG_ERROR($missing_library))
AC_CHECK_LIB([ssl], [main],, AC_MSG_ERROR($missing_library))
-AC_CHECK_LIB([mysqlclient], [main],, AC_MSG_ERROR($missing_library))
+if test "$use_mysql" = "yes"; then
+ AC_CHECK_LIB([mysqlclient], [main],, AC_MSG_ERROR($missing_library))
+fi
AC_CHECK_LIB([ssh], [sftp_tell64],, AC_MSG_RESULT([Could not find suitable version of libssh]))
AC_CHECK_LIB([bluetooth], [hci_devid],, AC_MSG_RESULT([Could not find suitable version of libbluetooth]))
AC_CHECK_LIB([yajl], [main],, AC_MSG_ERROR($missing_library))
@@ -1878,6 +1889,13 @@ else
final_message="$final_message\n ASAP Codec:\tNo"
fi
+if test "$use_mysql" = "yes"; then
+ final_message="$final_message\n MySQL:\tYes"
+ USE_MYSQL=1
+else
+ final_message="$final_message\n MySQL:\tNo"
+ USE_MYSQL=0
+fi
if test "$use_webserver" = "yes"; then
final_message="$final_message\n Webserver:\tYes"
USE_WEB_SERVER=1
@@ -2105,6 +2123,7 @@ AC_SUBST(USE_AIRTUNES)
AC_SUBST(USE_LIBUDEV)
AC_SUBST(USE_LIBUSB)
AC_SUBST(USE_LIBCEC)
+AC_SUBST(USE_MYSQL)
AC_SUBST(USE_WEB_SERVER)
View
11 xbmc/dbwrappers/Database.cpp
@@ -29,10 +29,12 @@
#include "utils/AutoPtrHandle.h"
#include "utils/log.h"
#include "utils/URIUtils.h"
-#include "mysqldataset.h"
#include "sqlitedataset.h"
#include "threads/SingleLock.h"
+#ifdef HAS_MYSQL
+#include "mysqldataset.h"
+#endif
using namespace AUTOPTR;
using namespace dbiplus;
@@ -263,6 +265,7 @@ bool CDatabase::Open(const DatabaseSettings &settings)
m_sqlite = true;
+#ifdef HAS_MYSQL
if ( dbSettings.type.Equals("mysql") )
{
// check we have all information before we cancel the fallback
@@ -273,6 +276,10 @@ bool CDatabase::Open(const DatabaseSettings &settings)
CLog::Log(LOGINFO, "Essential mysql database information is missing. Require at least host, user and pass defined.");
}
else
+#else
+ if ( dbSettings.type.Equals("mysql") )
+ CLog::Log(LOGERROR, "MySQL library requested but MySQL support is not compiled in. Falling back to sqlite3.");
+#endif
{
dbSettings.type = "sqlite3";
dbSettings.host = CSpecialProtocol::TranslatePath(g_settings.GetDatabaseFolder());
@@ -366,10 +373,12 @@ bool CDatabase::Connect(const DatabaseSettings &dbSettings, bool create)
{
m_pDB.reset( new SqliteDatabase() ) ;
}
+#ifdef HAS_MYSQL
else if (dbSettings.type.Equals("mysql"))
{
m_pDB.reset( new MysqlDatabase() ) ;
}
+#endif
else
{
CLog::Log(LOGERROR, "Unable to determine database type: %s", dbSettings.type.c_str());
View
5 xbmc/dbwrappers/mysqldataset.cpp
@@ -23,9 +23,11 @@
#include <string>
#include <set>
-#include "mysqldataset.h"
#include "utils/log.h"
#include "system.h" // for GetLastError()
+
+#ifdef HAS_MYSQL
+#include "mysqldataset.h"
#include "mysql/errmsg.h"
#ifdef _WIN32
#pragma comment(lib, "mysqlclient.lib")
@@ -1597,4 +1599,5 @@ void MysqlDataset::interrupt() {
}
}//namespace
+#endif //HAS_MYSQL
View
5 xbmc/system.h
@@ -80,6 +80,10 @@
#define HAS_AIRTUNES
#endif
+#ifdef HAVE_MYSQL
+ #define HAS_MYSQL
+#endif
+
/**********************
* Non-free Components
**********************/
@@ -118,6 +122,7 @@
#define HAVE_LIBCEC
#define HAVE_LIBMP3LAME
#define HAVE_LIBVORBISENC
+#define HAS_MYSQL
#define DECLARE_UNUSED(a,b) a b;
#endif

4 comments on commit 2d79579

@NHellFire

libs: libhdhomerun libid3tag imagelib libexif system/libcpluff-@ARCH@.so
ifeq (@USE_MYSQL@,1)
libs += cmyth
endif

That doesn't actually work. I've just tested it (as someone emailed me saying mythtv no longer works), make libs won't actually build cmyth.

This however, works:
ifeq (@USE_MYSQL@,1)
EXTRA_LIBS += cmyth
endif
libs: libhdhomerun libid3tag imagelib libexif system/libcpluff-@ARCH@.so $(EXTRA_LIBS)

@theuni
Team Kodi member
theuni commented on 2d79579 Jul 26, 2012

Heh, not sure what came over me on this one. Of course you're right. Will push a similar change.

@dteirney
Team Kodi member

I can confirm that the pasted contents above restores myth:// protocol support. Is that the proper fix or does something else need to be done?

@NHellFire

Mine is correct and is the functional version of what's already there.

Please sign in to comment.
Something went wrong with that request. Please try again.