Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Another run at getting rid of symbol issues

Change version.cpp -> libs/libmythbase/version.h, which we then include in
mythversion.h.  Also convert from extern const char * -> #define constants.
This will remove all of the symbols.  However, it comes at the cost of a
slightly slower re-compile as every file that uses the constants will need
recompiling.  If we wanted to get around that, we can use functions in
libmythbase as the access points, such that only one file needs a recompile,
and it is buried in a library, but still anything using said library will need
relinking.

Can't win, really.  Refs #9586
  • Loading branch information...
commit 70a157f96c5644510700057cb9437395188c67d9 1 parent c2c07a0
@Beirdo Beirdo authored
View
12 mythtv/Makefile
@@ -23,9 +23,10 @@ SUBDIRS += $(MAKE_SUBDIRS) $(QT_SUBDIRS)
distclean $(addsuffix _distclean,$(SUBDIRS)) \
install $(addsuffix _install, $(SUBDIRS)) \
uninstall $(addsuffix _uninstall,$(SUBDIRS)) \
- version.cpp
+ libs/libmythbase/version.h force
-all: version.cpp subdirs
+all: libs/libmythbase/version.h subdirs
+force:
config.mak:
$(error run configure to create $@)
@@ -34,7 +35,7 @@ config.mak:
# make -C mythtv
PWD := $(shell pwd)
-version.cpp: libs/libmythbase/mythversion.h
+libs/libmythbase/version.h: version.sh force
sh version.sh $(PWD)
# explicit subdir dependencies
@@ -59,7 +60,7 @@ locales/Makefile: locales/locales.pro
$(addsuffix /Makefile,$(QT_SUBDIRS)): %/Makefile :
cd $*; $(QMAKE) QMAKE=$(QMAKE) -o $(@F) $(<F)
-$(SUBDIRS): $(addsuffix /Makefile,$(SUBDIRS)) version.cpp
+$(SUBDIRS): $(addsuffix /Makefile,$(SUBDIRS)) libs/libmythbase/version.h
$(MAKE) -C $@
$(addsuffix _clean,$(SUBDIRS)): $(addsuffix /Makefile,$(SUBDIRS))
@@ -79,9 +80,10 @@ clean: $(addsuffix _clean,$(SUBDIRS))
distclean: $(addsuffix _distclean,$(SUBDIRS))
-rm -f libs/libmythbase/mythconfig.mak config.mak
-rm -f libs/libmythbase/mythconfig.h config.h
+ -rm -f libs/libmythbase/version.h
-rm -f libs/libavutil/avconfig.h
-rm -f external/FFmpeg/libavutil/avconfig.h
- -rm -f config.ep version.cpp
+ -rm -f config.ep
-rm -f $(addsuffix /Makefile,$(QT_SUBDIRS))
install: $(addsuffix _install,$(SUBDIRS))
View
10 mythtv/libs/libmyth/mythcommandlineparser.cpp
@@ -163,11 +163,9 @@ bool MythCommandLineParser::PreParse(
else if ((parseTypes & kCLPQueryVersion) &&
!strcmp(argv[argpos],"--version"))
{
- extern const char *myth_source_version;
- extern const char *myth_source_path;
cout << "Please attach all output as a file in bug reports." << endl;
- cout << "MythTV Version : " << myth_source_version << endl;
- cout << "MythTV Branch : " << myth_source_path << endl;
+ cout << "MythTV Version : " << MYTH_SOURCE_VERSION << endl;
+ cout << "MythTV Branch : " << MYTH_SOURCE_PATH << endl;
cout << "Network Protocol : " << MYTH_PROTO_VERSION << endl;
cout << "Library API : " << MYTH_BINARY_VERSION << endl;
cout << "QT Version : " << QT_VERSION_STR << endl;
@@ -709,10 +707,8 @@ QString MythCommandLineParser::GetHelpString(bool with_header) const
if (with_header)
{
- extern const char *myth_source_version;
- extern const char *myth_source_path;
QString versionStr = QString("%1 version: %2 [%3] www.mythtv.org")
- .arg(binname).arg(myth_source_path).arg(myth_source_version);
+ .arg(binname).arg(MYTH_SOURCE_PATH).arg(MYTH_SOURCE_VERSION);
msg << versionStr << endl;
msg << "Valid options are: " << endl;
}
View
1  mythtv/libs/libmythbase/.gitignore
@@ -1,2 +1,3 @@
mythconfig.mak
mythconfig.h
+version.h
View
4 mythtv/libs/libmythbase/libmythbase.pro
@@ -20,7 +20,7 @@ HEADERS += mythcorecontext.h mythsystem.h mythlocale.h storagegroup.h
HEADERS += mythcoreutil.h mythdownloadmanager.h mythtranslation.h
HEADERS += unzip.h unzip_p.h zipentry_p.h iso639.h iso3166.h mythmedia.h
HEADERS += util.h mythhdd.h mythcdrom.h autodeletedeque.h dbutil.h
-HEADERS += mythhttppool.h mythhttphandler.h mythdeque.h
+HEADERS += mythhttppool.h mythhttphandler.h mythdeque.h version.h
SOURCES += mythsocket.cpp mythsocketthread.cpp msocketdevice.cpp
SOURCES += mythdbcon.cpp mythdb.cpp oldsettings.cpp mythverbose.cpp
@@ -48,7 +48,7 @@ mingw {
# Install headers to same location as libmyth to make things easier
inc.path = $${PREFIX}/include/mythtv/
inc.files = mythverbose.h mythdbcon.h mythdbparams.h mythbaseexp.h mythdb.h
-inc.files += compat.h mythversion.h mythconfig.h mythconfig.mak
+inc.files += compat.h mythversion.h mythconfig.h mythconfig.mak version.h
inc.files += mythobservable.h mythevent.h httpcomms.h mcodecs.h
inc.files += mythtimer.h lcddevice.h exitcodes.h mythdirs.h mythstorage.h
inc.files += mythsocket.h mythsocket_cb.h msocketdevice.h
View
1  mythtv/libs/libmythbase/mythversion.h
@@ -3,6 +3,7 @@
#include "qglobal.h"
#include "mythbaseexp.h"
+#include "version.h"
#if ( QT_VERSION < 0x040500 )
#error You need Qt version >= 4.5.0 to compile MythTV.
View
4 mythtv/libs/libmythtv/datadirect.cpp
@@ -533,8 +533,6 @@ bool DDStructureParser::characters(const QString& pchars)
return true;
}
-extern const char *myth_source_version;
-
DataDirectProcessor::DataDirectProcessor(uint lp, QString user, QString pass) :
listings_provider(lp % DD_PROVIDER_COUNT),
userid(user), password(pass),
@@ -546,7 +544,7 @@ DataDirectProcessor::DataDirectProcessor(uint lp, QString user, QString pass) :
{
QMutexLocker locker(&user_agent_lock);
user_agent = QString("MythTV/%1.%2")
- .arg(MYTH_BINARY_VERSION).arg(myth_source_version);
+ .arg(MYTH_BINARY_VERSION).arg(MYTH_SOURCE_VERSION);
}
DataDirectURLs urls0(
View
8 mythtv/libs/libmythui/myththemedmenu.cpp
@@ -25,6 +25,7 @@
#include "mythdb.h"
#include "mythdirs.h"
#include "mythmedia.h"
+#include "mythversion.h"
MythThemedMenuState::MythThemedMenuState(MythScreenStack *parent,
const QString &name)
@@ -327,9 +328,6 @@ void MythThemedMenu::ShowMenu()
}
-extern const char *myth_source_version;
-extern const char *myth_source_path;
-
void MythThemedMenu::aboutScreen()
{
QString distro_line;
@@ -343,8 +341,8 @@ void MythThemedMenu::aboutScreen()
}
QString label = tr("Revision: %1\n Branch: %2\n %3")
- .arg(myth_source_version)
- .arg(myth_source_path)
+ .arg(MYTH_SOURCE_VERSION)
+ .arg(MYTH_SOURCE_PATH)
.arg(distro_line);
MythScreenStack* mainStack = GetMythMainWindow()->GetMainStack();
View
4 mythtv/libs/libmythupnp/upnpdevice.h
@@ -34,8 +34,6 @@
#include "refcounted.h"
#include "mythversion.h" // for MYTH_BINARY_VERSION
-extern const char *myth_source_version;
-
class UPnpDeviceDesc;
class UPnpDevice;
class UPnpService;
@@ -115,7 +113,7 @@ class UPNP_PUBLIC UPnpDevice
UPnpDevice()
{
m_sModelNumber = MYTH_BINARY_VERSION;
- m_sSerialNumber = myth_source_version;
+ m_sSerialNumber = MYTH_SOURCE_VERSION;
m_securityPin = false;
m_protocolVersion = MYTH_PROTO_VERSION;
}
View
9 mythtv/programs/mythbackend/housekeeper.cpp
@@ -29,10 +29,7 @@ using namespace std;
#include "scheduler.h"
#include "mythcoreutil.h"
#include "mythdownloadmanager.h"
-
-// Use this to determine what directories to look in on the download site
-extern const char *myth_source_path;
-extern const char *myth_binary_version;
+#include "mythversion.h"
static bool HouseKeeper_filldb_running = false;
@@ -637,7 +634,7 @@ void HouseKeeper::CleanupProgramListings(void)
void HouseKeeper::UpdateThemeChooserInfoCache(void)
{
- QString MythVersion = myth_source_path;
+ QString MythVersion = MYTH_SOURCE_PATH;
// FIXME: For now, treat git master the same as svn trunk
if (MythVersion == "master")
@@ -645,7 +642,7 @@ void HouseKeeper::UpdateThemeChooserInfoCache(void)
if (MythVersion != "trunk")
{
- MythVersion = myth_binary_version; // Example: 0.25.20101017-1
+ MythVersion = MYTH_BINARY_VERSION; // Example: 0.25.20101017-1
MythVersion.replace(QRegExp("\\.[0-9]{8,}.*"), "");
}
View
6 mythtv/programs/mythbackend/main.cpp
@@ -162,11 +162,9 @@ int main(int argc, char **argv)
return exitCode;
{
- extern const char *myth_source_version;
- extern const char *myth_source_path;
QString versionStr = QString("%1 version: %2 [%3] www.mythtv.org")
- .arg(basename(argv[0])).arg(myth_source_path)
- .arg(myth_source_version);
+ .arg(basename(argv[0])).arg(MYTH_SOURCE_PATH)
+ .arg(MYTH_SOURCE_VERSION);
VERBOSE(VB_IMPORTANT, versionStr);
}
View
11 mythtv/programs/mythfrontend/main.cpp
@@ -1183,13 +1183,10 @@ int main(int argc, char **argv)
QString binname = finfo.baseName();
- extern const char *myth_source_version;
- extern const char *myth_source_path;
-
VERBOSE(VB_IMPORTANT, QString("%1 version: %2 [%3] www.mythtv.org")
.arg(binname)
- .arg(myth_source_path)
- .arg(myth_source_version));
+ .arg(MYTH_SOURCE_PATH)
+ .arg(MYTH_SOURCE_VERSION));
bool ResetSettings = false;
@@ -1249,8 +1246,8 @@ int main(int argc, char **argv)
{
VERBOSE(VB_IMPORTANT, QString("%1 version: %2 [%3] www.mythtv.org")
.arg(binname)
- .arg(myth_source_path)
- .arg(myth_source_version));
+ .arg(MYTH_SOURCE_PATH)
+ .arg(MYTH_SOURCE_VERSION));
signal(SIGHUP, &log_rotate_handler);
}
View
7 mythtv/programs/mythfrontend/networkcontrol.cpp
@@ -905,14 +905,11 @@ QString NetworkControl::processQuery(NetworkCommand *nc)
}
else if (is_abbrev("version", nc->getArg(1)))
{
- extern const char *myth_source_version;
- extern const char *myth_source_path;
-
int dbSchema = gCoreContext->GetNumSetting("DBSchemaVer");
return QString("VERSION: %1/%2 %3 %4 QT/%5 DBSchema/%6")
- .arg(myth_source_version)
- .arg(myth_source_path)
+ .arg(MYTH_SOURCE_VERSION)
+ .arg(MYTH_SOURCE_PATH)
.arg(MYTH_BINARY_VERSION)
.arg(MYTH_PROTO_VERSION)
.arg(QT_VERSION_STR)
View
6 mythtv/programs/mythfrontend/statusbox.cpp
@@ -503,10 +503,8 @@ void StatusBox::doListingsStatus()
mfdNextRunStart.replace('T', ' ');
- extern const char *myth_source_version;
- extern const char *myth_source_path;
- AddLogLine(tr("Mythfrontend version: %1 (%2)").arg(myth_source_path)
- .arg(myth_source_version));
+ AddLogLine(tr("Mythfrontend version: %1 (%2)").arg(MYTH_SOURCE_PATH)
+ .arg(MYTH_SOURCE_VERSION));
AddLogLine(tr("Last mythfilldatabase guide update:"));
AddLogLine(tr("Started: %1").arg(mfdLastRunStart));
View
13 mythtv/programs/mythfrontend/themechooser.cpp
@@ -16,6 +16,7 @@
#include "programtypes.h"
#include "mythsystemevent.h"
#include "util.h"
+#include "mythversion.h"
// LibMythUI headers
#include "mythmainwindow.h"
@@ -30,10 +31,6 @@
#define LOC_WARN QString("ThemeChooser, Warning: ")
#define LOC_ERR QString("ThemeChooser, Error: ")
-// Use this to determine what directories to look in on the download site
-extern const char *myth_source_path;
-extern const char *myth_binary_version;
-
/*!
* \class RemoteFileDownloadThread
*/
@@ -144,7 +141,7 @@ void ThemeChooser::Load(void)
{
SetBusyPopupMessage(tr("Loading Installed Themes"));
- QString MythVersion = myth_source_path;
+ QString MythVersion = MYTH_SOURCE_PATH;
QStringList themesSeen;
QDir themes(GetConfDir() + "/themes");
themes.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
@@ -156,7 +153,7 @@ void ThemeChooser::Load(void)
if (MythVersion != "trunk")
{
- MythVersion = myth_binary_version; // Example: 0.25.20101017-1
+ MythVersion = MYTH_BINARY_VERSION; // Example: 0.25.20101017-1
MythVersion.replace(QRegExp("\\.[0-9]{8,}.*"), "");
}
@@ -869,7 +866,7 @@ void ThemeChooser::removeThemeDir(const QString &dirname)
ThemeUpdateChecker::ThemeUpdateChecker() :
m_updateTimer(new QTimer(this))
{
- m_mythVersion = myth_source_path;
+ m_mythVersion = MYTH_SOURCE_PATH;
// FIXME: For now, treat git master the same as svn trunk
if (m_mythVersion == "master")
@@ -877,7 +874,7 @@ ThemeUpdateChecker::ThemeUpdateChecker() :
if (m_mythVersion != "trunk")
{
- m_mythVersion = myth_binary_version; // Example: 0.25.20101017-1
+ m_mythVersion = MYTH_BINARY_VERSION; // Example: 0.25.20101017-1
m_mythVersion.replace(QRegExp("\\.[0-9]{8,}.*"), "");
}
View
7 mythtv/programs/mythjobqueue/main.cpp
@@ -293,13 +293,10 @@ int main(int argc, char *argv[])
pidfs.close();
}
- extern const char *myth_source_version;
- extern const char *myth_source_path;
-
VERBOSE(VB_IMPORTANT, QString("%1 version: %2 [%3] www.mythtv.org")
.arg(binname)
- .arg(myth_source_path)
- .arg(myth_source_version));
+ .arg(MYTH_SOURCE_PATH)
+ .arg(MYTH_SOURCE_VERSION));
gContext = new MythContext(MYTH_BINARY_VERSION);
if (!gContext->Init(false))
View
6 mythtv/programs/mythpreviewgen/main.cpp
@@ -230,11 +230,9 @@ int main(int argc, char **argv)
VERBOSE(VB_IMPORTANT, LOC_WARN + "Unable to ignore SIGPIPE");
{
- extern const char *myth_source_version;
- extern const char *myth_source_path;
QString versionStr = QString("%1 version: %2 [%3] www.mythtv.org")
- .arg(basename(argv[0])).arg(myth_source_path)
- .arg(myth_source_version);
+ .arg(basename(argv[0])).arg(MYTH_SOURCE_PATH)
+ .arg(MYTH_SOURCE_VERSION);
VERBOSE(VB_IMPORTANT, versionStr);
}
View
7 mythtv/programs/mythshutdown/main.cpp
@@ -734,13 +734,10 @@ static void showUsage()
{
QString binname = "mythshutdown";
- extern const char *myth_source_version;
- extern const char *myth_source_path;
-
VERBOSE(VB_IMPORTANT, QString("%1 version: %2 [%3] www.mythtv.org")
.arg(binname)
- .arg(myth_source_path)
- .arg(myth_source_version));
+ .arg(MYTH_SOURCE_PATH)
+ .arg(MYTH_SOURCE_VERSION));
cout << "Usage of mythshutdown\n";
cout << "-w/--setwakeup time (sets the wakeup time. time=yyyy-MM-ddThh:mm:ss\n";
View
11 mythtv/programs/mythtv-setup/main.cpp
@@ -297,13 +297,10 @@ int main(int argc, char *argv[])
QMap<QString, QString> settingsOverride;
- extern const char *myth_source_version;
- extern const char *myth_source_path;
-
VERBOSE(VB_IMPORTANT, QString("%1 version: %2 [%3] www.mythtv.org")
.arg(binname)
- .arg(myth_source_path)
- .arg(myth_source_version));
+ .arg(MYTH_SOURCE_PATH)
+ .arg(MYTH_SOURCE_VERSION));
for(int argpos = 1; argpos < a.argc(); ++argpos)
@@ -512,8 +509,8 @@ int main(int argc, char *argv[])
{
VERBOSE(VB_IMPORTANT, QString("%1 version: %2 [%3] www.mythtv.org")
.arg(binname)
- .arg(myth_source_path)
- .arg(myth_source_version));
+ .arg(MYTH_SOURCE_PATH)
+ .arg(MYTH_SOURCE_VERSION));
signal(SIGHUP, &log_rotate_handler);
}
View
7 mythtv/programs/mythwelcome/main.cpp
@@ -52,13 +52,10 @@ static void showUsage(const MythCommandLineParser &cmdlineparser)
QString binname = "mythwelcome";
- extern const char *myth_source_version;
- extern const char *myth_source_path;
-
VERBOSE(VB_IMPORTANT, QString("%1 version: %2 [%3] www.mythtv.org")
.arg(binname)
- .arg(myth_source_path)
- .arg(myth_source_version));
+ .arg(MYTH_SOURCE_PATH)
+ .arg(MYTH_SOURCE_VERSION));
cerr << "Valid options are: " << endl <<
"-v or --verbose debug-level Use '-v help' for level info" << endl <<
View
2  mythtv/version.pro
@@ -5,5 +5,5 @@
# "exported" is reported as the revision. #
############################################################
-SOURCES += $$PWD/version.cpp
+HEADERS += $$PWD/libs/libmythbase/version.h
DEPENDPATH += $$PWD/libs/libmythbase
View
13 mythtv/version.sh
@@ -36,15 +36,14 @@ case "${SOURCE_VERSION}" in
esac
cat > .vers.new <<EOF
-#include "mythversion.h"
-
-const char *myth_source_version = "${SOURCE_VERSION}";
-const char *myth_source_path = "${BRANCH}";
-const char *myth_binary_version = MYTH_BINARY_VERSION;
+#ifndef MYTH_SOURCE_VERSION
+#define MYTH_SOURCE_VERSION "${SOURCE_VERSION}"
+#define MYTH_SOURCE_PATH "${BRANCH}"
+#endif
EOF
# check if the version strings are changed and update version.pro if necessary
-if ! cmp -s .vers.new version.cpp; then
- mv -f .vers.new version.cpp
+if ! cmp -s .vers.new libs/libmythbase/version.h; then
+ mv -f .vers.new libs/libmythbase/version.h
fi
rm -f .vers.new
Please sign in to comment.
Something went wrong with that request. Please try again.