Skip to content
This repository

Allow compiling without mysql dependency (--disable-mysql) #1089

Closed
wants to merge 2 commits into from

4 participants

Schischu Cory Fields Memphiz odon
Schischu

This commit adds the possibility to build xbmc without mysql by just using sqlite (--disable-mysql).
This is needed as MySQL is a very heavy package and getting it to compile for sh cpu arch based embedded devices is probably not worth the trouble.

This also disables the build of cmyth if mysql is disabled, as cmyth depends on mysql.
But that does not hurt as sh cpu arch based devices are usally STBs with internal tuner and for that have no need for a myth connection to get livetv.

Deleted user
ghost commented

squash please

Deleted user
ghost commented

also, it's not mysql, it's mysqlclient. you'd run the db on a more powerful device.

Schischu

squash please
squash what?
Do you meen something like this: ?
git rebase --interactive HEAD~2

also, it's not mysql, it's mysqlclient. you'd run the db on a more powerful device.
Hm yeah but have you tried porting it to a new cpu arch and compiling it from scratch, just awful. I mean I want to run xbmc on my system and dont want to invest to much time in the dependencies.
Maybe I will do this sometime in the future but for now I am quite happy with sqlite.

Cory Fields
Owner
theuni commented

agreed with @Schischu on the need for this. Unfortunately, mysqlclient is part of the mysql build. Not that you have to install mysqld ofcourse, but having to build the whole thing can be cumbersome on obscure platforms.

As for squashing, yes.. do an interactive rebase and change efa4953 from 'keep' to 'fixup'.

Deleted user
ghost commented

Never argued for this not being welcome.

Schischu

Hope I squashed it correctly. :-)

Cory Fields
Owner
theuni commented

Looks good to me. Queued for July merge.

Thanks!

Memphiz
Owner

Are you sure that system.h is included somewhere in the chain where you check HAS_MYSQL? As its defined in system.h we have to be sure. Else mysql won't work - even if enabled via configure.

Schischu

Good point,
I just checked,
system.h is included in Database.cpp through Util.h.

Memphiz
Owner

Does this work on xbmc/dbwrappers/mysqldataset.h too? ^^

Schischu

Why should it? mysqldataset.h is only included by Database.cpp and mysqldataset.cpp.
And for mysqldataset.cpp it is only included if the define is set.
And as Database.cpp is compiled before mysqldataset.cpp the define is still defined.

Deleted user
ghost commented

uhm, defines are most certainly not transferred between compilation units.

Schischu

I pushed an updated version which is I think a more elegant solution than the many ifdefs.

Memphiz
Owner

I like the idea but xcode can't do conditional compile of source files. So at least in the cpp file you have to ifdef with the guard because the mysqldataset.cpp is going to be compiled there ... (maybe same for the win32 projects - not sure, but the guard is needed anyways).

Schischu Schischu 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.
7bf86db
Schischu

I see, commited a fix for xcode build.

Cory Fields theuni closed this
Cory Fields
Owner
theuni commented

Pushed manually with 2d79579

I changed a few things around and squashed back down, otherwise we would've had some broken revisions.

@Schischu I wanted to be sure your name was on the commit, so let's hope I didn't introduce any breakage that will henceforth be attributed to you :p

Schischu

Thanks :-)

Tobias Hieta tru referenced this pull request from a commit in RasPlex/plex-home-theatre
Tobias Hieta tru Fallback to local playlist instead of play queue on older servers and…
… secondary servers.

This fixes #1089
ef5e081
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 2 authors.

Jun 25, 2012
odon odon correct libxbmc broken link c2c6b19
Jun 26, 2012
Schischu Schischu 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.
7bf86db
This page is out of date. Refresh to see the latest.
11 Makefile.in
@@ -141,13 +141,16 @@ endif
141 141 LIB_DIRS=\
142 142 lib/cximage-6.0 \
143 143 lib/libexif \
144   - lib/cmyth \
145 144 lib/libhdhomerun \
146 145 lib/libid3tag \
147 146 lib/libapetag \
148 147 lib/cpluff \
149 148 lib/xbmc-dll-symbols
150 149
  150 +ifeq (@USE_MYSQL@,1)
  151 +LIB_DIRS += lib/cmyth
  152 +endif
  153 +
151 154 SS_DIRS=
152 155 ifneq (@DISABLE_RSXS@,1)
153 156 SS_DIRS+= xbmc/screensavers/rsxs-0.9/xbmc
@@ -288,8 +291,12 @@ else
288 291 endif
289 292 libexif: dllloader
290 293 $(MAKE) -C lib/libexif
  294 +ifeq (@USE_MYSQL@,1)
291 295 cmyth: dllloader
292 296 $(MAKE) -C lib/cmyth
  297 +else
  298 +cmyth:
  299 +endif
293 300 libhdhomerun: dllloader
294 301 $(MAKE) -C lib/libhdhomerun
295 302 libid3tag: dllloader
@@ -349,7 +356,7 @@ OBJSXBMC:=$(filter-out $(DYNOBJSXBMC), $(OBJSXBMC))
349 356
350 357 LIBS += @PYTHON_LDFLAGS@
351 358
352   -libxbmc.so: $(OBJSXBMC) $(DYNOBJSXBMC)
  359 +libxbmc.so: $(OBJSXBMC) $(DYNOBJSXBMC) $(NWAOBJSXBMC)
353 360 ifeq ($(findstring osx,@ARCH@), osx)
354 361 $(SILENT_LD) $(CXX) $(LDFLAGS) -bundle -o $@ -Wl,-all_load,-ObjC $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(OBJSXBMC) $(LIBS)
355 362 else
37 configure.in
@@ -381,6 +381,12 @@ AC_ARG_ENABLE([asap-codec],
381 381 [use_asap=$enableval],
382 382 [use_asap=no])
383 383
  384 +AC_ARG_ENABLE([mysql],
  385 + [AS_HELP_STRING([--disable-mysql],
  386 + [disable mysql])],
  387 + [use_mysql=$enableval],
  388 + [use_mysql=yes])
  389 +
384 390 AC_ARG_ENABLE([webserver],
385 391 [AS_HELP_STRING([--disable-webserver],
386 392 [disable webserver])],
@@ -733,14 +739,17 @@ else
733 739 fi
734 740
735 741 # platform common libraries
736   -AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, "yes", "no")
737   -if test $MYSQL_CONFIG = "yes"; then
738   - INCLUDES="$INCLUDES `mysql_config --include`"
739   - MYSQL_LIBS=`mysql_config --libs`
740   - LIBS="$LIBS $MYSQL_LIBS"
741   - AC_SUBST(MYSQL_LIBS)
742   -else
743   - AC_MSG_ERROR($missing_program)
  742 +if test "$use_mysql" = "yes"; then
  743 + AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, "yes", "no")
  744 + if test $MYSQL_CONFIG = "yes"; then
  745 + AC_DEFINE([HAVE_MYSQL],[1],["Define to 1 if you have the `mysql' library (-lmysqlclient)."])
  746 + INCLUDES="$INCLUDES `mysql_config --include`"
  747 + MYSQL_LIBS=`mysql_config --libs`
  748 + LIBS="$LIBS $MYSQL_LIBS"
  749 + AC_SUBST(MYSQL_LIBS)
  750 + else
  751 + AC_MSG_ERROR($missing_program)
  752 + fi
744 753 fi
745 754 AC_CHECK_HEADER([ass/ass.h],, AC_MSG_ERROR($missing_library))
746 755 AC_CHECK_HEADER([mpeg2dec/mpeg2.h],, AC_MSG_ERROR($missing_library))
@@ -779,7 +788,9 @@ AC_CHECK_LIB([lzo2], [main],, AC_MSG_ERROR($missing_library))
779 788 AC_CHECK_LIB([z], [main],, AC_MSG_ERROR($missing_library))
780 789 AC_CHECK_LIB([crypto], [main],, AC_MSG_ERROR($missing_library))
781 790 AC_CHECK_LIB([ssl], [main],, AC_MSG_ERROR($missing_library))
782   -AC_CHECK_LIB([mysqlclient], [main],, AC_MSG_ERROR($missing_library))
  791 +if test "$use_mysql" = "yes"; then
  792 + AC_CHECK_LIB([mysqlclient], [main],, AC_MSG_ERROR($missing_library))
  793 +fi
783 794 AC_CHECK_LIB([ssh], [sftp_tell64],, AC_MSG_RESULT([Could not find suitable version of libssh]))
784 795 AC_CHECK_LIB([bluetooth], [hci_devid],, AC_MSG_RESULT([Could not find suitable version of libbluetooth]))
785 796 AC_CHECK_LIB([yajl], [main],, AC_MSG_ERROR($missing_library))
@@ -1880,6 +1891,13 @@ else
1880 1891 final_message="$final_message\n ASAP Codec:\tNo"
1881 1892 fi
1882 1893
  1894 +if test "$use_mysql" = "yes"; then
  1895 + final_message="$final_message\n MySQL:\tYes"
  1896 + USE_MYSQL=1
  1897 +else
  1898 + final_message="$final_message\n MySQL:\tNo"
  1899 + USE_MYSQL=0
  1900 +fi
1883 1901 if test "$use_webserver" = "yes"; then
1884 1902 final_message="$final_message\n Webserver:\tYes"
1885 1903 USE_WEB_SERVER=1
@@ -2094,6 +2112,7 @@ AC_SUBST(USE_AIRTUNES)
2094 2112 AC_SUBST(USE_LIBUDEV)
2095 2113 AC_SUBST(USE_LIBUSB)
2096 2114 AC_SUBST(USE_LIBCEC)
  2115 +AC_SUBST(USE_MYSQL)
2097 2116 AC_SUBST(USE_WEB_SERVER)
2098 2117
2099 2118
6 xbmc/dbwrappers/Database.cpp
@@ -29,9 +29,11 @@
29 29 #include "utils/AutoPtrHandle.h"
30 30 #include "utils/log.h"
31 31 #include "utils/URIUtils.h"
32   -#include "mysqldataset.h"
33 32 #include "sqlitedataset.h"
34 33
  34 +#ifdef HAS_MYSQL
  35 +#include "mysqldataset.h"
  36 +#endif
35 37
36 38 using namespace AUTOPTR;
37 39 using namespace dbiplus;
@@ -363,10 +365,12 @@ bool CDatabase::Connect(const DatabaseSettings &dbSettings, bool create)
363 365 {
364 366 m_pDB.reset( new SqliteDatabase() ) ;
365 367 }
  368 +#ifdef HAS_MYSQL
366 369 else if (dbSettings.type.Equals("mysql"))
367 370 {
368 371 m_pDB.reset( new MysqlDatabase() ) ;
369 372 }
  373 +#endif
370 374 else
371 375 {
372 376 CLog::Log(LOGERROR, "Unable to determine database type: %s", dbSettings.type.c_str());
7 xbmc/dbwrappers/Makefile
... ... @@ -1,8 +1,11 @@
1 1 SRCS=Database.cpp \
2 2 dataset.cpp \
3   - mysqldataset.cpp \
4 3 qry_dat.cpp \
5   - sqlitedataset.cpp \
  4 + sqlitedataset.cpp
  5 +
  6 +ifeq (@USE_MYSQL@,1)
  7 +SRCS+=mysqldataset.cpp
  8 +endif
6 9
7 10 LIB=dbwrappers.a
8 11
5 xbmc/dbwrappers/mysqldataset.cpp
@@ -23,9 +23,11 @@
23 23 #include <string>
24 24 #include <set>
25 25
26   -#include "mysqldataset.h"
27 26 #include "utils/log.h"
28 27 #include "system.h" // for GetLastError()
  28 +
  29 +#ifdef HAS_MYSQL
  30 +#include "mysqldataset.h"
29 31 #include "mysql/errmsg.h"
30 32 #ifdef _WIN32
31 33 #pragma comment(lib, "mysqlclient.lib")
@@ -1597,4 +1599,5 @@ void MysqlDataset::interrupt() {
1597 1599 }
1598 1600
1599 1601 }//namespace
  1602 +#endif //HAS_MYSQL
1600 1603
4 xbmc/system.h
@@ -80,6 +80,10 @@
80 80 #define HAS_AIRTUNES
81 81 #endif
82 82
  83 +#ifdef HAVE_MYSQL
  84 + #define HAS_MYSQL
  85 +#endif
  86 +
83 87 /**********************
84 88 * Non-free Components
85 89 **********************/

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.