[mythtv] [PATCH] Allow non-root installs

Jim Radford mythtv-dev@snowman.net
Tue, 15 Oct 2002 01:30:25 -0700


Hi Isaac,

I like to install programs without being root, but mythtv hardcodes
"/usr/local" as its destination, so this isn't easy.  With this patch

  o The PREFIX is easily changeable by only editing settings.pro.[1]

  o As non root user ldconfig can fail.  Ignore that so we aren't kept
    from installing the .xml files.

  o If files like mainmenu.xml are not found don't return "" since
    it is meaningless and it will get used blindly anyway.  Might as
    well return the file were are given.

-Jim

[1] I notice that most of the .pro files are generated, but as I'm not
    sure from what I edited them directly.  They are checked into CVS
    after all.


Index: settings.pro
===================================================================
RCS file: /var/lib/cvs/MC/settings.pro,v
retrieving revision 1.4
diff -u -r1.4 settings.pro
--- settings.pro	5 Oct 2002 06:50:50 -0000	1.4
+++ settings.pro	15 Oct 2002 08:22:33 -0000
@@ -1,9 +1,13 @@
+PREFIX = /usr/local
+
 #CONFIG += debug
 CONFIG += release
 
-INCLUDEPATH += /usr/local/include
+INCLUDEPATH += $${PREFIX}/include
+INCLUDEPATH *= /usr/local/include
 
 DEFINES += _GNU_SOURCE
+DEFINES += PREFIX=\"$${PREFIX}\"
 release {
         DEFINES += MMX
         QMAKE_CXXFLAGS_RELEASE = -O6 -march=pentiumpro -fomit-frame-pointer -funroll-loops -fexpensive-optimizations -finline-functions -fno-rtti -fno-exceptions
Index: filters/invert/invert.pro
===================================================================
RCS file: /var/lib/cvs/MC/filters/invert/invert.pro,v
retrieving revision 1.3
diff -u -r1.3 invert.pro
--- filters/invert/invert.pro	21 Sep 2002 20:05:07 -0000	1.3
+++ filters/invert/invert.pro	15 Oct 2002 08:22:33 -0000
@@ -2,10 +2,12 @@
 # Automatically generated by qmake (1.03a) Fri Aug 23 15:01:33 2002
 ######################################################################
 
+include( ../../settings.pro )
+
 TEMPLATE = lib
 CONFIG -= moc
 CONFIG += plugin thread
-target.path = /usr/local/lib/mythtv/filters
+target.path = $${PREFIX}/lib/mythtv/filters
 INSTALLS = target
 
 INCLUDEPATH += ../../libs/libNuppelVideo
Index: filters/linearblend/linearblend.pro
===================================================================
RCS file: /var/lib/cvs/MC/filters/linearblend/linearblend.pro,v
retrieving revision 1.3
diff -u -r1.3 linearblend.pro
--- filters/linearblend/linearblend.pro	21 Sep 2002 20:05:07 -0000	1.3
+++ filters/linearblend/linearblend.pro	15 Oct 2002 08:22:33 -0000
@@ -2,10 +2,12 @@
 # Automatically generated by qmake (1.03a) Fri Aug 23 15:01:33 2002
 ######################################################################
 
+include( ../../settings.pro )
+
 TEMPLATE = lib
 CONFIG -= moc
 CONFIG += plugin thread
-target.path = /usr/local/lib/mythtv/filters
+target.path = $${PREFIX}/lib/mythtv/filters
 INSTALLS = target
 
 INCLUDEPATH += ../../libs/libNuppelVideo
Index: filters/postprocess/postprocess.pro
===================================================================
RCS file: /var/lib/cvs/MC/filters/postprocess/postprocess.pro,v
retrieving revision 1.2
diff -u -r1.2 postprocess.pro
--- filters/postprocess/postprocess.pro	21 Sep 2002 20:05:07 -0000	1.2
+++ filters/postprocess/postprocess.pro	15 Oct 2002 08:22:34 -0000
@@ -2,10 +2,12 @@
 # Automatically generated by qmake (1.03a) Fri Aug 23 15:01:33 2002
 ######################################################################
 
+include( ../../settings.pro )
+
 TEMPLATE = lib
 CONFIG -= moc
 CONFIG += plugin thread
-target.path = /usr/local/lib/mythtv/filters
+target.path = $${PREFIX}/lib/mythtv/filters
 INSTALLS = target
 
 INCLUDEPATH += ../../libs/libNuppelVideo
Index: libs/libNuppelVideo/filter.h
===================================================================
RCS file: /var/lib/cvs/MC/libs/libNuppelVideo/filter.h,v
retrieving revision 1.2
diff -u -r1.2 filter.h
--- libs/libNuppelVideo/filter.h	31 Aug 2002 14:25:26 -0000	1.2
+++ libs/libNuppelVideo/filter.h	15 Oct 2002 08:22:34 -0000
@@ -7,7 +7,7 @@
 
 #include "frame.h"
 
-#define MYTHTV_FILTER_PATH "/usr/local/lib/mythtv/filters"
+#define MYTHTV_FILTER_PATH PREFIX "/lib/mythtv/filters"
 
 typedef struct  VideoFilter_
 {
Index: libs/libmyth/libmyth.pro
===================================================================
RCS file: /var/lib/cvs/MC/libs/libmyth/libmyth.pro,v
retrieving revision 1.5
diff -u -r1.5 libmyth.pro
--- libs/libmyth/libmyth.pro	21 Sep 2002 20:33:16 -0000	1.5
+++ libs/libmyth/libmyth.pro	15 Oct 2002 08:22:34 -0000
@@ -2,16 +2,16 @@
 # Automatically generated by qmake (1.02a) Tue Jul 16 20:40:47 2002
 ######################################################################
 
+include ( ../../settings.pro )
+
 TEMPLATE = lib
 TARGET = myth
 CONFIG += thread dll
-target.path = /usr/local/lib
+target.path = $${PREFIX}/lib
 INSTALLS = target
 
 VERSION = 0.6.0
 
-include ( ../../settings.pro )
-
 # Input
 HEADERS += dialogbox.h guidegrid.h infodialog.h infostructs.h lcddevice.h 
 HEADERS += programinfo.h settings.h themedmenu.h 
@@ -19,7 +19,7 @@
 SOURCES += dialogbox.cpp guidegrid.cpp infodialog.cpp infostructs.cpp 
 SOURCES += lcddevice.cpp programinfo.cpp settings.cpp themedmenu.cpp
 
-inc.path = /usr/local/include/mythtv/
+inc.path = $${PREFIX}/include/mythtv/
 inc.files = $$HEADERS
 
 INSTALLS += inc
Index: libs/libmyth/themedmenu.cpp
===================================================================
RCS file: /var/lib/cvs/MC/libs/libmyth/themedmenu.cpp,v
retrieving revision 1.7
diff -u -r1.7 themedmenu.cpp
--- libs/libmyth/themedmenu.cpp	28 Sep 2002 20:28:52 -0000	1.7
+++ libs/libmyth/themedmenu.cpp	15 Oct 2002 08:22:35 -0000
@@ -1202,7 +1202,7 @@
     if (file.exists())
         return testdir;
         
-    return "";
+    return menuname;
 }
 
 void ThemedMenu::handleAction(QString &action)
Index: libs/libmythtv/libmythtv.pro
===================================================================
RCS file: /var/lib/cvs/MC/libs/libmythtv/libmythtv.pro,v
retrieving revision 1.8
diff -u -r1.8 libmythtv.pro
--- libs/libmythtv/libmythtv.pro	21 Sep 2002 20:05:07 -0000	1.8
+++ libs/libmythtv/libmythtv.pro	15 Oct 2002 08:22:35 -0000
@@ -11,7 +11,7 @@
 INCLUDEPATH += ../libNuppelVideo ../
 TARGETDEPS = ../libNuppelVideo/libNuppelVideo.a 
 
-installfiles.path = /usr/local/share/mythtv
+installfiles.path = $${PREFIX}/share/mythtv
 installfiles.files = helr.ttf
 installfiles.files += settings.txt
 
Index: libs/libmythtv/tv.cpp
===================================================================
RCS file: /var/lib/cvs/MC/libs/libmythtv/tv.cpp,v
retrieving revision 1.80
diff -u -r1.80 tv.cpp
--- libs/libmythtv/tv.cpp	9 Oct 2002 05:40:34 -0000	1.80
+++ libs/libmythtv/tv.cpp	15 Oct 2002 08:22:37 -0000
@@ -27,7 +27,7 @@
 #define wsEnter         0x8d + 256
 #define wsReturn        0x0d + 256
 
-char theprefix[] = "/usr/local";
+char theprefix[] = PREFIX;
 
 void *SpawnEncode(void *param)
 {
Index: programs/menutest/main.cpp
===================================================================
RCS file: /var/lib/cvs/MC/programs/menutest/main.cpp,v
retrieving revision 1.3
diff -u -r1.3 main.cpp
--- programs/menutest/main.cpp	18 Sep 2002 03:00:36 -0000	1.3
+++ programs/menutest/main.cpp	15 Oct 2002 08:22:37 -0000
@@ -6,7 +6,7 @@
 #include "settings.h"
 
 Settings *globalsettings;
-char installprefix[] = "/usr/local";
+char installprefix[] = PREFIX;
 
 int main(int argc, char **argv)
 {
Index: programs/mythdialog/mythdialog.pro
===================================================================
RCS file: /var/lib/cvs/MC/programs/mythdialog/mythdialog.pro,v
retrieving revision 1.7
diff -u -r1.7 mythdialog.pro
--- programs/mythdialog/mythdialog.pro	21 Sep 2002 20:05:07 -0000	1.7
+++ programs/mythdialog/mythdialog.pro	15 Oct 2002 08:22:37 -0000
@@ -2,12 +2,12 @@
 # Automatically generated by qmake (1.02a) Tue Jul 2 15:55:32 2002
 ######################################################################
 
+include (../../settings.pro)
+
 TEMPLATE = app
 CONFIG += thread
-target.path = /usr/local/bin
+target.path = $${PREFIX}/bin
 INSTALLS = target
-
-include (../../settings.pro)
 
 INCLUDEPATH += ../../libs/libNuppelVideo ../../libs
 LIBS += -lmyth -L/usr/local/lib -L../../libs/libmyth
Index: programs/mythepg/mythepg.pro
===================================================================
RCS file: /var/lib/cvs/MC/programs/mythepg/mythepg.pro,v
retrieving revision 1.13
diff -u -r1.13 mythepg.pro
--- programs/mythepg/mythepg.pro	21 Sep 2002 20:14:03 -0000	1.13
+++ programs/mythepg/mythepg.pro	15 Oct 2002 08:22:37 -0000
@@ -2,12 +2,12 @@
 # Automatically generated by qmake (1.02a) Mon Jul 8 22:32:30 2002
 ######################################################################
 
+include (../../settings.pro)
+
 TEMPLATE = app
 CONFIG += thread
-target.path = /usr/local/bin
+target.path = $${PREFIX}/bin
 INSTALLS = target
-
-include (../../settings.pro)
 
 INCLUDEPATH += ../../libs
 LIBS += -L../../libs/libmyth -lmyth
Index: programs/mythfilldatabase/filldata.cpp
===================================================================
RCS file: /var/lib/cvs/MC/programs/mythfilldatabase/filldata.cpp,v
retrieving revision 1.9
diff -u -r1.9 filldata.cpp
--- programs/mythfilldatabase/filldata.cpp	6 Oct 2002 07:21:43 -0000	1.9
+++ programs/mythfilldatabase/filldata.cpp	15 Oct 2002 08:22:37 -0000
@@ -19,7 +19,7 @@
 #include "libmyth/settings.h"
 
 Settings *globalsettings;
-char installprefix[] = "/usr/local";
+char installprefix[] = PREFIX;
 
 using namespace std;
 
Index: programs/mythfilldatabase/mythfilldatabase.pro
===================================================================
RCS file: /var/lib/cvs/MC/programs/mythfilldatabase/mythfilldatabase.pro,v
retrieving revision 1.3
diff -u -r1.3 mythfilldatabase.pro
--- programs/mythfilldatabase/mythfilldatabase.pro	21 Sep 2002 20:05:07 -0000	1.3
+++ programs/mythfilldatabase/mythfilldatabase.pro	15 Oct 2002 08:22:37 -0000
@@ -2,14 +2,14 @@
 # Automatically generated by qmake (1.03a) Sat Aug 31 10:10:35 2002
 ######################################################################
 
+include ( ../../settings.pro )
+
 TEMPLATE = app
 CONFIG += thread
 CONFIG -= moc
 TARGET = mythfilldatabase
-target.path = /usr/local/bin
+target.path = $${PREFIX}/bin
 INSTALLS = target
-
-include ( ../../settings.pro )
 
 INCLUDEPATH += ../../libs/
 LIBS += -lmyth -L/usr/local/lib -L../../libs/libmyth
Index: programs/mythfrontend/main.cpp
===================================================================
RCS file: /var/lib/cvs/MC/programs/mythfrontend/main.cpp,v
retrieving revision 1.36
diff -u -r1.36 main.cpp
--- programs/mythfrontend/main.cpp	14 Oct 2002 23:58:44 -0000	1.36
+++ programs/mythfrontend/main.cpp	15 Oct 2002 08:22:38 -0000
@@ -18,7 +18,7 @@
 #include "libmyth/themedmenu.h"
 #include "libmyth/programinfo.h"
 
-char installprefix[] = "/usr/local";
+char installprefix[] = PREFIX;
 
 QString prefix;
 QMap<int, TV *> tvList;
Index: programs/mythfrontend/mythfrontend.pro
===================================================================
RCS file: /var/lib/cvs/MC/programs/mythfrontend/mythfrontend.pro,v
retrieving revision 1.19
diff -u -r1.19 mythfrontend.pro
--- programs/mythfrontend/mythfrontend.pro	9 Oct 2002 20:24:14 -0000	1.19
+++ programs/mythfrontend/mythfrontend.pro	15 Oct 2002 08:22:38 -0000
@@ -2,17 +2,17 @@
 # Automatically generated by qmake (1.02a) Mon Jul 8 22:32:30 2002
 ######################################################################
 
+include ( ../../settings.pro )
+
 TEMPLATE = app
 CONFIG += thread
 TARGET = mythfrontend
-target.path = /usr/local/bin
+target.path = $${PREFIX}/bin
 INSTALLS = target
 
-include ( ../../settings.pro )
-
-setting.path = /usr/local/share/mythtv/
+setting.path = $${PREFIX}/share/mythtv/
 setting.files += theme.txt mysql.txt mainmenu.xml tvmenu.xml
-setting.extra = ldconfig
+setting.extra = -ldconfig
 
 INSTALLS += setting
 
Index: programs/mythlcd/main.cpp
===================================================================
RCS file: /var/lib/cvs/MC/programs/mythlcd/main.cpp,v
retrieving revision 1.2
diff -u -r1.2 main.cpp
--- programs/mythlcd/main.cpp	21 Sep 2002 22:06:17 -0000	1.2
+++ programs/mythlcd/main.cpp	15 Oct 2002 08:22:38 -0000
@@ -13,7 +13,7 @@
 //
 
 Settings *globalsettings;
-char installprefix[] = "/usr/local";
+char installprefix[] = PREFIX;
 
 
 int main(int argc, char **argv)
@@ -34,4 +34,4 @@
 	return a.exec();
 
     
-}
\ No newline at end of file
+}
Index: programs/mythtv/main.cpp
===================================================================
RCS file: /var/lib/cvs/MC/programs/mythtv/main.cpp,v
retrieving revision 1.10
diff -u -r1.10 main.cpp
--- programs/mythtv/main.cpp	3 Oct 2002 20:01:31 -0000	1.10
+++ programs/mythtv/main.cpp	15 Oct 2002 08:22:38 -0000
@@ -5,7 +5,7 @@
 #include "tv.h"
 
 Settings *globalsettings;
-char installprefix[] = "/usr/local";
+char installprefix[] = PREFIX;
 
 int main(int argc, char *argv[])
 {
Index: programs/mythtv/mythtv.pro
===================================================================
RCS file: /var/lib/cvs/MC/programs/mythtv/mythtv.pro,v
retrieving revision 1.7
diff -u -r1.7 mythtv.pro
--- programs/mythtv/mythtv.pro	9 Oct 2002 20:24:14 -0000	1.7
+++ programs/mythtv/mythtv.pro	15 Oct 2002 08:22:38 -0000
@@ -2,13 +2,13 @@
 # Automatically generated by qmake (1.02a) Tue Jul 16 21:01:49 2002
 ######################################################################
 
+include ( ../../settings.pro )
+
 TEMPLATE = app
 CONFIG += thread
 TARGET = mythtv
-target.path = /usr/local/bin
+target.path = $${PREFIX}/bin
 INSTALLS = target
-
-include ( ../../settings.pro )
 
 INCLUDEPATH += ../../libs/libNuppelVideo ../../libs/libmythtv ../../libs
 LIBS += -L../../libs/libNuppelVideo -L../../libs/libmythtv 
Index: themes/themes.pro
===================================================================
RCS file: /var/lib/cvs/MC/themes/themes.pro,v
retrieving revision 1.2
diff -u -r1.2 themes.pro
--- themes/themes.pro	21 Sep 2002 23:29:07 -0000	1.2
+++ themes/themes.pro	15 Oct 2002 08:22:38 -0000
@@ -2,10 +2,12 @@
 # Automatically generated by qmake (1.03a) Sat Sep 21 15:30:26 2002
 ######################################################################
 
+include ( ../settings.pro )
+
 TEMPLATE = app
 CONFIG -= moc qt
 
-themes.path = /usr/local/share/mythtv/themes/
+themes.path = $${PREFIX}/share/mythtv/themes/
 themes.files = blue liquid defaultosd
 
 INSTALLS += themes