1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-22 19:27:13 +01:00

path on Mac

This commit is contained in:
Vadim Kurland 2008-07-25 03:30:28 +00:00
parent 3e2d50258b
commit 6ea2fca59b
10 changed files with 77 additions and 42 deletions

View File

@ -1 +1 @@
#define BUILD_NUM 405
#define BUILD_NUM 407

View File

@ -1,3 +1,8 @@
2008-07-24 vadim <vadim@vk.crocodile.org>
* init.cpp (guessExecPath): properly managing path to the bundle
on Mac.
2008-07-22 Vadim Kurland <vadim@vk.crocodile.org>
* FWWindow.cpp: Applied patch to make code compile with gcc 4.3 per
@ -10,12 +15,11 @@
* (libfwbuilder) Applied patch for gcc 4.3 per bug #2023676:
"libfwbuilder does not build against gcc 4.3".
* (libfwbuilder) fwbuilder.pro: removed unnecessary override in
target.path to make it install in a proper place on 64 bit
machines'
2008-07-20 <vadim@vk.crocodile.org>
* RuleSetView.cpp (RuleTableModel::insertRow): fixed bug (no #)

View File

@ -11,15 +11,15 @@ SO_VERSION = @LIBFWBUILDER_SOLIB_VERSION@
DEFINES += $$(DEFINES)
LANGUAGE = C++
UI_DIR = ui
MANDIR = /home/vadim/src/fwb3-branch-v3/install_root/share/man/
DOCDIR = /home/vadim/src/fwb3-branch-v3/install_root/share/doc/fwbuilder-3.0.0
MANDIR = /Users/vadim/src/fwb3-branch-v3/install_root/share/man/
DOCDIR = /Users/vadim/src/fwb3-branch-v3/install_root/share/doc/fwbuilder-3.0.0
HAVE_ANTLR_RUNTIME = 1
HAVE_EXTERNAL_ANTLR = 0
unix {
ANTLR_INCLUDEPATH = /home/vadim/src/fwb3-branch-v3/source/fwbuilder/src/
ANTLR_LIBS = /home/vadim/src/fwb3-branch-v3/source/fwbuilder/src/antlr/libantlr.a
ANTLR_INCLUDEPATH = /Users/vadim/src/fwb3-branch-v3/source/fwbuilder/src/
ANTLR_LIBS = /Users/vadim/src/fwb3-branch-v3/source/fwbuilder/src/antlr/libantlr.a
FWBPARSER_LIB = ../parsers/libfwbparser.a
}
@ -30,36 +30,36 @@ unix {
MOC_DIR = .moc
OBJECTS_DIR = .obj
PREFIX = /home/vadim/src/fwb3-branch-v3/install_root
PREFIX = /Users/vadim/src/fwb3-branch-v3/install_root
exec_prefix = @EXEC_PREFIX@
DESTDIR =
INCLUDEPATH += .. ../.. $$(INCLUDEPATH) /home/vadim/src/fwb3-branch-v3/install_root/include/ /home/vadim/src/fwb3-branch-v3/install_root/include/fwb-3 /usr/include/libxml2
INCLUDEPATH += .. ../.. $$(INCLUDEPATH) /Users/vadim/src/fwb3-branch-v3/install_root/include/ /Users/vadim/src/fwb3-branch-v3/install_root/include/fwb-3 /usr/include/libxml2
LIBS_FWCOMPILER = -L/home/vadim/src/fwb3-branch-v3/install_root/lib -pthread -lfwcompiler -lfwbuilder -lxslt -lxml2 -lnetsnmp -lm -lwrap
LIBS_FWBUILDER = -L/home/vadim/src/fwb3-branch-v3/install_root/lib -pthread -lfwbuilder -lxslt -lxml2 -lnetsnmp -lm -lwrap
LIBS_FWCOMPILER = -L/Users/vadim/src/fwb3-branch-v3/install_root/lib -lfwcompiler -lfwbuilder -lxslt -lxml2 -lz -lpthread -licucore -lm -lnetsnmp
LIBS_FWBUILDER = -L/Users/vadim/src/fwb3-branch-v3/install_root/lib -lfwbuilder -lxslt -lxml2 -lz -lpthread -licucore -lm -lnetsnmp
target.path = $$PREFIX/bin
dtd.path = @TEMPLATE_DIR@/
migration.path = @TEMPLATE_DIR@/migration
doc.path = /home/vadim/src/fwb3-branch-v3/install_root/share/doc/fwbuilder-3.0.0
doc.path = /Users/vadim/src/fwb3-branch-v3/install_root/share/doc/fwbuilder-3.0.0
# win32:target.path = $$PREFIX/
# unix:target.path = $$PREFIX/share/fwbuilder/
# macx:target.path = $$PREFIX/
res.files = src/res/objects_init.xml src/res/templates.xml src/res/resources.xml
res.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.0
res.path = ../Resources
res_os.files = src/res/os/*.xml
res_os.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.0/os/
res_os.path = ../Resources/os/
res_platform.files = src/res/platform/*.xml
res_platform.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.0/platform/
res_platform.path = ../Resources/platform/
INSTALLS += res
INSTALLS += res_os
INSTALLS += res_platform
# INSTALLS += icns
LIBS += $$LIBS_FWBUILDER -lutil
LIBS += $$LIBS_FWBUILDER -L/sw/lib -lpoll
PKGLOCALEDIR = $$res.path/locale

View File

@ -45,6 +45,12 @@ string guessExecPath(const char *argv0)
#ifdef Q_OS_MACX
if (QCoreApplication::instance()==NULL)
{
int ac = 0;
char **av = { NULL };
new QApplication( ac, av );
}
QDir dir(QApplication::applicationDirPath());
return string(dir.absolutePath().toAscii().constData());
@ -70,18 +76,24 @@ string guessExecPath(const char *argv0)
#endif
}
/*
* We do all these different hacks on different OS in order to be able
* to avoid dependency on QT on Linux and BSD, so people can
* (theoretically) build and install compilers on the firewall machine
* where they do not have X11 and QT. It may not be easy but should be
* possible. (Unless I broke it in 3.0)
*/
string findExecutable(const char *argv0)
{
#ifdef _WIN32
/* see explanation about _pgmptr here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getmodulefilename.asp
*/
string res;
res = _pgmptr;
return res;
#else
//#ifdef _WIN32
///* see explanation about _pgmptr here:
//http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getmodulefilename.asp
//*/
// string res;
//
// res = _pgmptr;
// return res;
//#else
#ifdef OS_LINUX
/* on modern Linux systems full path to the executable is available in
@ -96,7 +108,7 @@ http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/ge
#else
return guessExecPath(argv0);
#endif
#endif
//#endif
}

View File

@ -210,7 +210,8 @@ RCSEnvFix::RCSEnvFix()
* everything works. When the program is started with some other
* directory as current dir, RCS tools fail without any error message.
*/
env.push_back( QString("PATH=%1;%2").arg(appRootDir.c_str()).arg(getenv("PATH")) );
env.push_back(
QString("PATH=%1;%2").arg(getPathToBinary("").c_str()).arg(getenv("PATH")) );
#endif
/* also need to set env variable USER for rcs tools, but if the user name
@ -245,19 +246,19 @@ RCS::RCS(const QString &file)
{
#ifdef _WIN32
string ts;
ts = appRootDir+FS_SEPARATOR+RCS_FILE_NAME ;
ts = getPathToBinary(RCS_FILE_NAME);
rcs_file_name = ts.c_str();
ts = appRootDir+FS_SEPARATOR+RLOG_FILE_NAME ;
ts = getPathToBinary(RLOG_FILE_NAME);
rlog_file_name = ts.c_str();
ts = appRootDir+FS_SEPARATOR+RCSDIFF_FILE_NAME ;
ts = getPathToBinary(RCSDIFF_FILE_NAME);
rcsdiff_file_name = ts.c_str();
ts = appRootDir+FS_SEPARATOR+CI_FILE_NAME ;
ts = getPathToBinary(CI_FILE_NAME);
ci_file_name = ts.c_str();
ts = appRootDir+FS_SEPARATOR+CO_FILE_NAME ;
ts = getPathToBinary(CO_FILE_NAME);
co_file_name = ts.c_str();
#else
rcs_file_name = RCS_FILE_NAME ;

View File

@ -1627,7 +1627,8 @@ bool instDialog::testFirewall(Firewall *fw)
cnf.fwdir = s;
*/
cnf.diff_pgm = QString(appRootDir.c_str()) + cnf.diff_pgm;
cnf.diff_pgm = getPathToBinary(
cnf.diff_pgm.toAscii().constData()).c_str();
#ifdef _WIN32
cnf.diff_pgm = cnf.diff_pgm + ".exe";
@ -1710,9 +1711,13 @@ Can't compile firewall policy."),
else
{
/* try to find compiler in appRootDir. */
string ts = appRootDir + FS_SEPARATOR + compiler;
string ts = getPathToBinary(compiler);
if (fwbdebug)
qDebug("Checking compiler in %s", ts.c_str());
if ( QFile::exists( ts.c_str() ) )
compiler = appRootDir + FS_SEPARATOR + compiler;
compiler = ts;
}
}
#endif

View File

@ -28,6 +28,7 @@
#include "../../config.h"
#include "global.h"
#include "utils.h"
#include "utils_no_qt.h"
#include "iosaclAdvancedDialog.h"
#include "SimpleTextEditor.h"
@ -101,9 +102,9 @@ iosaclAdvancedDialog::iosaclAdvancedDialog(QWidget *parent,FWObject *o)
else
{
/* try to find compiler in appRootDir. */
string ts = appRootDir + FS_SEPARATOR + compiler;
string ts = getPathToBinary(compiler);
if ( QFile::exists( ts.c_str() ) )
compiler = appRootDir + FS_SEPARATOR + compiler;
compiler = ts;
}
}
#endif

View File

@ -28,6 +28,7 @@
#include "../../config.h"
#include "global.h"
#include "utils.h"
#include "utils_no_qt.h"
#include "pixAdvancedDialog.h"
#include "SimpleTextEditor.h"
@ -95,9 +96,9 @@ pixAdvancedDialog::pixAdvancedDialog(QWidget*, FWObject *o)//(parent)
else
{
/* try to find compiler in appRootDir. */
string ts = appRootDir + FS_SEPARATOR + compiler;
string ts = getPathToBinary(compiler);
if ( QFile::exists( ts.c_str() ) )
compiler = appRootDir + FS_SEPARATOR + compiler;
compiler = ts;
}
}
#endif

View File

@ -125,8 +125,17 @@ string strip(const string &s)
return s.substr(n1, n2-n1);
}
void join::operator()(std::string &s)
void join::operator()(string &s)
{
if (!result->empty()) *result += separator;
*result += s;
}
string getPathToBinary(const string &pgm_name)
{
#if defined(Q_OS_MACX)
return appRootDir + FS_SEPARATOR + "MacOS" + FS_SEPARATOR + pgm_name;
#else
return appRootDir + FS_SEPARATOR + pgm_name;
#endif
}

View File

@ -75,7 +75,9 @@ extern libfwbuilder::FWReference* findRef(libfwbuilder::FWObject *o,
// helper: strip whitespaces from the beginning and end of a string
extern std::string strip(const std::string &s);
extern std::string getPathToBinary(const std::string &pgm_name);
// a functor to join list<string> into a string with separator sep
class join : public std::unary_function<std::string, void>
{