[PC-BSD Commits] r5516 - in pbibuild/pbi-source: PBIsource PBItext
svn at pcbsd.org
svn at pcbsd.org
Wed Dec 9 11:50:12 PST 2009
Author: kris
Date: 2009-12-09 11:50:12 -0800 (Wed, 09 Dec 2009)
New Revision: 5516
Modified:
pbibuild/pbi-source/PBIsource/pbi.cpp
pbibuild/pbi-source/PBIsource/pbi.h
pbibuild/pbi-source/PBItext/main.cpp
Log:
Updated PBI installer, added support for using System Fonts / GL directly, so we don't need
to keep scripting in that support
Modified: pbibuild/pbi-source/PBIsource/pbi.cpp
===================================================================
--- pbibuild/pbi-source/PBIsource/pbi.cpp 2009-12-09 19:46:43 UTC (rev 5515)
+++ pbibuild/pbi-source/PBIsource/pbi.cpp 2009-12-09 19:50:12 UTC (rev 5516)
@@ -264,6 +264,14 @@
{
ProgramAuthor = line.replace("ProgAuthor: ", "");
}
+ if ( line.indexOf("ProgUseSysFonts:") == 0)
+ {
+ ProgramUseSysFonts = line.replace("ProgUseSysFonts: ", "");
+ }
+ if ( line.indexOf("ProgUseSysGL:") == 0)
+ {
+ ProgramUseSysGL = line.replace("ProgUseSysGL: ", "");
+ }
if ( line.indexOf("ProgUpdateURL:") == 0)
{
ProgUpdateURL = line.replace("ProgUpdateURL: ", "");
@@ -718,8 +726,12 @@
// Check if there is a custom script to be run
CheckScriptSlot();
-
+ // Check if we need to do any system fonts
+ mkSysFontLinks();
+ // Check if we need to use the system GL libs
+ useSystemGL();
+
}
void PBI::doDesktopInstallScript()
@@ -2308,3 +2320,55 @@
QTimer::singleShot( 1000, this, SLOT(slotRecheckChecksumFinished()) );
}
}
+
+// Function which make symlinks for fonts to use system's
+void PBI::mkSysFontLinks()
+{
+ QDir fontDir1, fontDir2, testDir;
+ QString basePath;
+
+ if ( ProgramUseSysFonts == "NO" )
+ return;
+
+
+ // Remove the old font dirs from our PBI
+ fontDir1.setPath("/Programs/" + ProgDirName + "/etc/fonts");
+ if (fontDir1.exists() && ! ProgDirName.isEmpty() )
+ system("rm -rf /Programs/" + ProgDirName.toLatin1() + "/etc/fonts");
+
+ // Add the new font dirs from our PBI
+ fontDir1.setPath("/Programs/" + ProgDirName + "/lib/X11/fonts");
+ if (fontDir1.exists() && ! ProgDirName.isEmpty() )
+ system("rm -rf /Programs/" + ProgDirName.toLatin1() + "/lib/X11/fonts");
+
+ // Make our font links
+ testDir.setPath("/PCBSD/local/etc/fonts");
+ if (testDir.exists() )
+ basePath = "/PCBSD/local";
+ else
+ basePath = "/usr/local";
+
+ fontDir1.setPath("/Programs/" + ProgDirName + "/etc");
+ if (!fontDir1.exists())
+ fontDir1.mkpath(fontDir1.path());
+
+ fontDir2.setPath("/Programs/" + ProgDirName + "/lib/X11");
+ if (!fontDir2.exists())
+ fontDir2.mkpath(fontDir2.path());
+
+ system("ln -fs " + basePath.toLatin1() + "/etc/fonts /Programs/" + ProgDirName.toLatin1() + "/etc/fonts");
+ system("ln -fs " + basePath.toLatin1() + "/lib/X11/fonts /Programs/" + ProgDirName.toLatin1() + "/lib/X11/fonts");
+}
+
+// Function which gets rid of GL libs, so we can use system's
+void PBI::useSystemGL()
+{
+ if ( ProgramUseSysGL == "NO" )
+ return;
+
+ if ( !ProgDirName.isEmpty() )
+ {
+ system("rm /Programs/" + ProgDirName.toLatin1() + "/lib/libGL.* >/dev/null 2>/dev/null");
+ system("rm /Programs/" + ProgDirName.toLatin1() + "/lib/libGLU.* >/dev/null 2>/dev/null");
+ }
+}
Modified: pbibuild/pbi-source/PBIsource/pbi.h
===================================================================
--- pbibuild/pbi-source/PBIsource/pbi.h 2009-12-09 19:46:43 UTC (rev 5515)
+++ pbibuild/pbi-source/PBIsource/pbi.h 2009-12-09 19:50:12 UTC (rev 5516)
@@ -67,10 +67,14 @@
private:
void doDesktopInstallScript();
+ void mkSysFontLinks();
+ void useSystemGL();
QString ProgramName;
QString ProgramVer;
QString ProgramAuthor;
QString ProgramWeb;
+ QString ProgramUseSysFonts;
+ QString ProgramUseSysGL;
QString LibDir;
QString DefaultIcon;
QString ProgramDir;
Modified: pbibuild/pbi-source/PBItext/main.cpp
===================================================================
--- pbibuild/pbi-source/PBItext/main.cpp 2009-12-09 19:46:43 UTC (rev 5515)
+++ pbibuild/pbi-source/PBItext/main.cpp 2009-12-09 19:50:12 UTC (rev 5516)
@@ -25,11 +25,15 @@
void slotSetupCustomRemoveScript();
void runKmenuRegen();
void doDesktopInstallScript();
+void mkSysFontLinks();
+void useSystemGL();
QString ProgramName;
QString ProgramVer;
QString ProgramAuthor;
QString ProgramWeb;
+QString ProgramUseSysFonts;
+QString ProgramUseSysGL;
int ProgSize;
QString LibDir;
QString DefaultIcon;
@@ -308,6 +312,14 @@
{
ProgramAuthor = line.replace("ProgAuthor: ", "");
}
+ if ( line.indexOf("ProgUseSysFonts:") == 0)
+ {
+ ProgramUseSysFonts = line.replace("ProgUseSysFonts: ", "");
+ }
+ if ( line.indexOf("ProgUseSysGL:") == 0)
+ {
+ ProgramUseSysGL = line.replace("ProgUseSysGL: ", "");
+ }
if ( line.indexOf("ProgUpdateURL:") == 0)
{
ProgUpdateURL = line.replace("ProgUpdateURL: ", "");
@@ -687,7 +699,12 @@
// Check if there is a custom script to be run
CheckScriptSlot();
+ // Check if we need to do any system fonts
+ mkSysFontLinks();
+ // Check if we need to use the system GL libs
+ useSystemGL();
+
}
@@ -1366,3 +1383,55 @@
}
+// Function which make symlinks for fonts to use system's
+void mkSysFontLinks()
+{
+
+ if ( ProgramUseSysFonts == "NO" )
+ return;
+
+ QDir fontDir1, fontDir2, testDir;
+ QString basePath;
+
+ // Remove the old font dirs from our PBI
+ fontDir1.setPath("/Programs/" + ProgDirName + "/etc/fonts");
+ if (fontDir1.exists() && ! ProgDirName.isEmpty() )
+ system("rm -rf /Programs/" + ProgDirName.toLatin1() + "/etc/fonts");
+
+ // Add the new font dirs from our PBI
+ fontDir1.setPath("/Programs/" + ProgDirName + "/lib/X11/fonts");
+ if (fontDir1.exists() && ! ProgDirName.isEmpty() )
+ system("rm -rf /Programs/" + ProgDirName.toLatin1() + "/lib/X11/fonts");
+
+ // Make our font links
+ testDir.setPath("/PCBSD/local/etc/fonts");
+ if (testDir.exists() )
+ basePath = "/PCBSD/local";
+ else
+ basePath = "/usr/local";
+
+ fontDir1.setPath("/Programs/" + ProgDirName + "/etc");
+ if (!fontDir1.exists())
+ fontDir1.mkpath(fontDir1.path());
+
+ fontDir2.setPath("/Programs/" + ProgDirName + "/lib/X11");
+ if (!fontDir2.exists())
+ fontDir2.mkpath(fontDir2.path());
+
+ system("ln -fs " + basePath.toLatin1() + "/etc/fonts /Programs/" + ProgDirName.toLatin1() + "/etc/fonts");
+ system("ln -fs " + basePath.toLatin1() + "/lib/X11/fonts /Programs/" + ProgDirName.toLatin1() + "/lib/X11/fonts");
+}
+
+// Function which gets rid of GL libs, so we can use system's
+void useSystemGL()
+{
+ if ( ProgramUseSysGL == "NO" )
+ return;
+
+ if ( !ProgDirName.isEmpty() )
+ {
+ system("rm /Programs/" + ProgDirName.toLatin1() + "/lib/libGL.* >/dev/null 2>/dev/null");
+ system("rm /Programs/" + ProgDirName.toLatin1() + "/lib/libGLU.* >/dev/null 2>/dev/null");
+ }
+}
+
More information about the Commits
mailing list