From 0530ee62fd03b4daf4e526c352edeef3287cd660 Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Sat, 19 Jul 2008 18:13:58 +0000 Subject: [PATCH] fixed Mac OS X package --- build_num | 2 +- doc/ChangeLog | 7 ++++--- doc/fwbuilder.1 | 6 +++--- qmake.inc | 26 +++++++++++++------------- src/common/init.cpp | 40 ++++++++++++++++------------------------ src/gui/debugDialog.cpp | 2 +- src/gui/main.cpp | 39 ++++++++++++++++++++++++++++----------- 7 files changed, 66 insertions(+), 56 deletions(-) diff --git a/build_num b/build_num index 6b614094f..914bedf98 100644 --- a/build_num +++ b/build_num @@ -1 +1 @@ -#define BUILD_NUM 391 +#define BUILD_NUM 392 diff --git a/doc/ChangeLog b/doc/ChangeLog index ca9fd53fb..64b3cec30 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -282,10 +282,11 @@ chains". * main.cpp: implemented printing of the firewall object contents - from CLI per bug #1996739: "Feature: CLI printing or policy export" - + from CLI per bug #1996739: "Feature: CLI printing or policy export". + Use command line flag "-P " to print and exit. + 2008-06-16 - + * newHostDiaog.cpp: fixed bug #1899488: "Unable to set MAC address while adding a host" diff --git a/doc/fwbuilder.1 b/doc/fwbuilder.1 index fbb6d2d1c..1c5418ff4 100644 --- a/doc/fwbuilder.1 +++ b/doc/fwbuilder.1 @@ -12,7 +12,7 @@ fwbuilder \- Multiplatform firewall configuration tool .RB [-d] .RB [-h] .RB [-o file] -.RB [-p object_name] +.RB [-P object_name] .RB [-v] @@ -53,9 +53,9 @@ lots of output on standard error. This is used for debugging. Prints brief help message .IP "-o file" -Specify the name of the file for the print output, see option "-p". +Specify the name of the file for the print output, see option "-P". -.IP "-p object_name" +.IP "-P object_name" Print rules and objects for the firewall object "object_name" and immediately exit. The program does not go into interactive mode and does not need X11. Print output will be placed in the file specified diff --git a/qmake.inc b/qmake.inc index 235850e66..dacae5284 100644 --- a/qmake.inc +++ b/qmake.inc @@ -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 diff --git a/src/common/init.cpp b/src/common/init.cpp index f0fd7144d..638495ddb 100644 --- a/src/common/init.cpp +++ b/src/common/init.cpp @@ -11,8 +11,10 @@ #endif #ifdef Q_OS_MACX -# include -# include +# include +# include +//# include +//# include #endif #include @@ -42,20 +44,9 @@ string guessExecPath(const char *argv0) { #ifdef Q_OS_MACX -// see http://doc.trolltech.com/3.3/mac-differences.html#7-1 -// except that article explains how to get path to bundle, while -// we need path to executable here. Using CFBundleCopyExecutableURL -// instead of CFBundleCopyBundleURL -// - CFURLRef bundleURL = CFBundleCopyExecutableURL(CFBundleGetMainBundle()); - CFStringRef macPath = CFURLCopyFileSystemPath(bundleURL, - kCFURLPOSIXPathStyle); - const char *pathPtr = CFStringGetCStringPtr(macPath, - CFStringGetSystemEncoding()); - CFRelease(bundleURL); - CFRelease(macPath); - return pathPtr; + QDir dir(QApplication::applicationDirPath()); + return string(dir.absolutePath().toAscii().constData()); #else @@ -71,7 +62,8 @@ string guessExecPath(const char *argv0) while ( !(s=path.section(':',i1,i1)).isEmpty() ) { s=s+"/"+argv0; - if (access(s.toLatin1().constData(),F_OK|X_OK)==0) return s.toLatin1().constData(); + if (access(s.toLatin1().constData(),F_OK|X_OK)==0) + return s.toLatin1().constData(); i1++; } return argv0; @@ -111,11 +103,11 @@ http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/ge void init(char * const *argv) { - argv0=findExecutable(argv[0]); + argv0 = findExecutable(argv[0]); - string::size_type n0=argv0.find_last_of("/\\"); - if (n0!=string::npos) appRootDir=argv0.substr(0,n0) + FS_SEPARATOR; - else appRootDir=""; + string::size_type n0 = argv0.find_last_of("/\\"); + if (n0!=string::npos) appRootDir = argv0.substr(0,n0) + FS_SEPARATOR; + else appRootDir = ""; libfwbuilder::init(); @@ -124,12 +116,12 @@ void init(char * const *argv) /* On windows and mac we install API resources (DTD etc) in the * dir right above the one where we install resources for the GUI and compilers */ - if (respath=="") respath = appRootDir+RES_DIR; - n0=respath.find_last_of("/\\"); + if (respath=="") respath = appRootDir + RES_DIR; + n0 = respath.find_last_of("/\\"); librespath = respath.substr(0,n0); - sysfname = respath+FS_SEPARATOR+"objects_init.xml"; - tempfname = respath+FS_SEPARATOR+"templates.xml"; + sysfname = respath + FS_SEPARATOR+"objects_init.xml"; + tempfname = respath + FS_SEPARATOR+"templates.xml"; #else diff --git a/src/gui/debugDialog.cpp b/src/gui/debugDialog.cpp index 69ff53596..f6a785e25 100644 --- a/src/gui/debugDialog.cpp +++ b/src/gui/debugDialog.cpp @@ -97,7 +97,7 @@ debugDialog::debugDialog(QWidget *parent) : QDialog(parent) m_dialog->debugText->append( QString("Versions:") ); m_dialog->debugText->append( QString(" Firewall Builder %1") .arg(VERSION) ); - m_dialog->debugText->append( QString(" Release %1 Build %2") + m_dialog->debugText->append( QString(" Revision %1 Build %2") .arg(RELEASE_NUM).arg(BUILD_NUM) ); m_dialog->debugText->append( QString(" Using libfwbuilder %1") .arg( libfwbuilder::Constants::getLibraryVersion().c_str() ) ); diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 17bdf6189..af152ad41 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -134,6 +134,8 @@ int fwbdebug = 0; bool safemode = false; bool registered = false; bool gui_experiment1 = false; +bool cli_print = false; +QString cli_print_fwname = ""; #ifndef _WIN32 @@ -331,7 +333,7 @@ void usage() } -int main( int argc, char ** argv ) +int main( int argc, char *argv[] ) { @@ -343,8 +345,6 @@ int main( int argc, char ** argv ) print_output_file_name=""; fwbdebug=0; safemode=false; - bool pparam=false; - QString pparamValue=""; if(fwbdebug) qDebug("main()"); @@ -544,10 +544,19 @@ int main( int argc, char ** argv ) } #endif + if (fwbdebug) + { + qDebug("Command line: argc=%d", argc); + for (int i=0; isetOrganizationName(QLatin1String("NetCitadel LLC")); + app->setApplicationName(QLatin1String("Firewall Builder")); + + /* need to initialize in order to be able to use FWBSettings */ init(argv); init_platforms(); +#if 0 if (fwbdebug) qDebug("Creating app ..."); - //QApplication::setDesktopSettingsAware(desktopaware); app = new QApplication( argc, argv ); app->setOrganizationName(QLatin1String("NetCitadel LLC")); app->setApplicationName(QLatin1String("Firewall Builder")); +#endif Q_INIT_RESOURCE(MainRes); @@ -617,10 +633,11 @@ int main( int argc, char ** argv ) true, true, fwbdebug); #endif - if (pparam) + if (cli_print) { + if (fwbdebug) qDebug("Print from command line"); FWWindow::printFirewallFromFile(filename, - pparamValue, + cli_print_fwname, print_output_file_name); return 0; }