configure.py
changeset 34 ed14f46c0e55
parent 7 923ff622b8b9
equal deleted inserted replaced
31:7516d6d86cf5 34:ed14f46c0e55
   190                              help="Install plugins to <dir>. The default value is 'PREFIX/plugins'.")
   190                              help="Install plugins to <dir>. The default value is 'PREFIX/plugins'.")
   191             group.add_option("--features-dir", dest="featuresdir", metavar="dir",
   191             group.add_option("--features-dir", dest="featuresdir", metavar="dir",
   192                              help="Install qmake feature files to <dir>. The default value is 'QTDIR/mkspecs/features'.")
   192                              help="Install qmake feature files to <dir>. The default value is 'QTDIR/mkspecs/features'.")
   193             group.add_option("--resources-dir", dest="resourcesdir", metavar="dir",
   193             group.add_option("--resources-dir", dest="resourcesdir", metavar="dir",
   194                              help="Install resources to <dir>. The default value is 'PREFIX/resources'.")
   194                              help="Install resources to <dir>. The default value is 'PREFIX/resources'.")
       
   195             group.add_option("--translations-dir", dest="translationsdir", metavar="dir",
       
   196                              help="Install translation files to <dir>. The default value is 'PREFIX/translations'.")
   195             self.add_option_group(group)
   197             self.add_option_group(group)
   196         self.set_defaults(prefix=None)
   198         self.set_defaults(prefix=None)
   197         self.set_defaults(bindir=None)
   199         self.set_defaults(bindir=None)
   198         self.set_defaults(libdir=None)
   200         self.set_defaults(libdir=None)
   199         self.set_defaults(docdir=None)
   201         self.set_defaults(docdir=None)
   200         self.set_defaults(includedir=None)
   202         self.set_defaults(includedir=None)
   201         self.set_defaults(pluginsdir=None)
   203         self.set_defaults(pluginsdir=None)
   202         self.set_defaults(featuresdir=None)
   204         self.set_defaults(featuresdir=None)
   203         self.set_defaults(resourcesdir=None)
   205         self.set_defaults(resourcesdir=None)
       
   206         self.set_defaults(translationsdir=None)
   204 
   207 
   205         group = optparse.OptionGroup(self, "Configure options")
   208         group = optparse.OptionGroup(self, "Configure options")
   206         group.add_option("--platform", dest="platform", metavar="platform",
   209         group.add_option("--platform", dest="platform", metavar="platform",
   207                          help="Specify the platform (symbian/win32/unix). "
   210                          help="Specify the platform (symbian/win32/unix). "
   208                               "The one detected by qmake is used by default "
   211                               "The one detected by qmake is used by default "
   211                          help="Specify the make tool (make, nmake, mingw32-make, gmake...). "
   214                          help="Specify the make tool (make, nmake, mingw32-make, gmake...). "
   212                               "The one detected in PATH is used by default if not specified.")
   215                               "The one detected in PATH is used by default if not specified.")
   213         if QMAKE.platform() == "win32" and MAKE.bin() == "nmake":
   216         if QMAKE.platform() == "win32" and MAKE.bin() == "nmake":
   214             group.add_option("--msvc", action="store_true", dest="msvc",
   217             group.add_option("--msvc", action="store_true", dest="msvc",
   215                              help="Generate a MSVC solution.")
   218                              help="Generate a MSVC solution.")
   216         group.add_option("--release", action="store_const", dest="config", const="release",
   219         group.add_option("--release", action="store_const", dest="release", const="release",
   217                          help="Build in release mode.")
   220                          help="Build in release mode.")
   218         group.add_option("--debug", action="store_const", dest="config", const="debug",
   221         group.add_option("--debug", action="store_const", dest="debug", const="debug",
   219                          help="Build in debug mode.")
   222                          help="Build in debug mode.")
   220         group.add_option("--debug_and_release", action="store_const", dest="config", const="debug_and_release",
   223         group.add_option("--debug_and_release", action="store_const", dest="debug_and_release", const="debug_and_release",
   221                          help="Build in both debug and release modes.")
   224                          help="Build in both debug and release modes.")
   222         group.add_option("--debug-output", action="store_false", dest="debug_output",
   225         group.add_option("--config", action="append", dest="config", metavar="config",
   223                          help="Do not suppress debug and warning output (suppressed by default in release mode).")
   226                          help="Add qmake configurations.")
       
   227         group.add_option("--debug-output", action="store_true", dest="debug_output",
       
   228                             help="Do not suppress debug and warning output (suppressed by default in release-armv5 builds on Symbian).")
   224         group.add_option("--no-debug-output", action="store_true", dest="no_debug_output",
   229         group.add_option("--no-debug-output", action="store_true", dest="no_debug_output",
   225                          help="Suppress debug and warning output (not supporessed by default in debug mode).")
   230                             help="Suppress debug and warning output (suppressed by default in release-armv5 builds on Symbian).")
   226         if QMAKE.platform() != "symbian":
   231         if QMAKE.platform() != "symbian":
   227             group.add_option("--silent", action="store_true", dest="silent",
   232             group.add_option("--silent", action="store_true", dest="silent",
   228                              help="Suppress verbose compiler output.")
   233                              help="Suppress verbose compiler output.")
   229             group.add_option("--fast", action="store_true", dest="fast",
   234             group.add_option("--fast", action="store_true", dest="fast",
   230                              help="Run qmake in non-recursive mode. Running qmake "
   235                              help="Run qmake in non-recursive mode. Running qmake "
   231                                   "in recursive mode (default) is more reliable but "
   236                                   "in recursive mode (default) is more reliable but "
   232                                   "takes relatively long due to deep project hierarchy. "
   237                                   "takes relatively long due to deep project hierarchy. "
   233                                   "The build tree should be clean ie. no existing "
   238                                   "The build tree should be clean ie. no existing "
   234                                   "makefiles in subdirs, because those won't be "
   239                                   "makefiles in subdirs, because those won't be "
   235                                   "regenerated if this option is enabled.")
   240                                   "regenerated if this option is enabled.")
       
   241         group.add_option("--define", action="append", dest="define", metavar="define",
       
   242                          help="Add compiler macros eg. --define HB_FOO_DEBUG --define HB_BAR_ENABLED.")
   236         group.add_option("--defines", dest="defines", metavar="defines",
   243         group.add_option("--defines", dest="defines", metavar="defines",
   237                          help="Define compiler macros for selecting features "
   244                          help=optparse.SUPPRESS_HELP)
   238                               "and debugging purposes eg. --defines HB_FOO_DEBUG,HB_BAR_ENABLED")
       
   239         if QMAKE.platform() == "unix":
   245         if QMAKE.platform() == "unix":
   240             group.add_option("--rpath", action="store_true", dest="rpath",
   246             group.add_option("--rpath", action="store_true", dest="rpath",
   241                              help="Link Hb libraries and executables using the library install "
   247                              help="Link Hb libraries and executables using the library install "
   242                                   "path as a runtime library path.")
   248                                   "path as a runtime library path.")
   243             group.add_option("--no-rpath", action="store_false", dest="rpath",
   249             group.add_option("--no-rpath", action="store_false", dest="rpath",
   244                              help="Do not use the library install path as a runtime library path.")
   250                              help="Do not use the library install path as a runtime library path.")
   245         self.add_option_group(group)
   251         self.add_option_group(group)
   246         self.set_defaults(platform=None)
   252         self.set_defaults(platform=None)
   247         self.set_defaults(makebin=None)
   253         self.set_defaults(makebin=None)
   248         self.set_defaults(msvc=None)
   254         self.set_defaults(msvc=None)
       
   255         self.set_defaults(release=None)
       
   256         self.set_defaults(debug=None)
       
   257         self.set_defaults(debug_and_release=None)
   249         self.set_defaults(config=None)
   258         self.set_defaults(config=None)
   250         self.set_defaults(silent=False)
   259         self.set_defaults(silent=False)
   251         self.set_defaults(fast=False)
   260         self.set_defaults(fast=False)
       
   261         self.set_defaults(define=None)
   252         self.set_defaults(defines=None)
   262         self.set_defaults(defines=None)
   253         self.set_defaults(rpath=None)
   263         self.set_defaults(rpath=None)
   254 
   264 
   255         group = optparse.OptionGroup(self, "Host options")
   265         group = optparse.OptionGroup(self, "Host options")
   256         group.add_option("--host-qmake-bin", dest="hostqmakebin", metavar="path",
   266         group.add_option("--host-qmake-bin", dest="hostqmakebin", metavar="path",
   267                               "in PATH is used by default if not specified.")
   277                               "in PATH is used by default if not specified.")
   268         group.add_option("--qmake-spec", dest="qmakespec", metavar="spec",
   278         group.add_option("--qmake-spec", dest="qmakespec", metavar="spec",
   269                          help="The operating system and compiler you are building on.")
   279                          help="The operating system and compiler you are building on.")
   270         group.add_option("--qmake-options", dest="qmakeopt", metavar="options",
   280         group.add_option("--qmake-options", dest="qmakeopt", metavar="options",
   271                          help="Additional qmake options "
   281                          help="Additional qmake options "
   272                               "eg. --qmake-options \"CONFIG+=foo DEFINES+=BAR\".")
   282                               "eg. --qmake-options \"QMAKE_CC=gcc-4.1 QMAKE_CXX=g++-4.1\".")
   273         self.add_option_group(group)
   283         self.add_option_group(group)
   274         self.set_defaults(qmakeopt=None)
   284         self.set_defaults(qmakeopt=None)
   275 
   285 
   276         group = optparse.OptionGroup(self, "Feature options")
   286         group = optparse.OptionGroup(self, "Feature options")
   277         group.add_option("--make", action="append", dest="make", metavar="part",
   287         group.add_option("--make", action="append", dest="make", metavar="part",
   278                          help="Do build <part>. Valid parts: tests localization performance")
   288                          help="Do build <part>. Valid parts: tests localization performance")
   279         group.add_option("--nomake", action="append", dest="nomake", metavar="part",
   289         group.add_option("--nomake", action="append", dest="nomake", metavar="part",
   280                          help="Do not build <part>. Valid parts: <collection> tutorials tests fute unit localization performance")
   290                          help="Do not build <part>. Valid parts: <collection> tutorials tests fute unit localization performance")
   281         group.add_option("--no-effects", action="store_false", dest="effects",
   291         group.add_option("--no-effects", action="store_false", dest="effects",
   282                          help="Do not build effects.")
   292                          help=optparse.SUPPRESS_HELP)
   283         group.add_option("--no-gestures", action="store_false", dest="gestures",
   293         group.add_option("--no-gestures", action="store_false", dest="gestures",
   284                          help="Do not build gestures.")
   294                          help=optparse.SUPPRESS_HELP)
   285         group.add_option("--no-text-measurement", action="store_false", dest="textMeasurement",
   295         group.add_option("--no-text-measurement", action="store_false", dest="textMeasurement",
   286                          help="Do not build text measurement support (needed for localization).")
   296                          help="Do not build text measurement support (needed for localization).")
   287         self.add_option_group(group)
   297         self.add_option_group(group)
   288         self.set_defaults(make=None)
   298         self.set_defaults(make=None)
   289         self.set_defaults(nomake=None)
   299         self.set_defaults(nomake=None)
   290         self.set_defaults(effects=True)
   300         self.set_defaults(effects=None)
   291         self.set_defaults(gestures=True)
   301         self.set_defaults(gestures=None)
   292         self.set_defaults(textMeasurement=True)
   302         self.set_defaults(textMeasurement=True)
   293 
   303 
   294         group = optparse.OptionGroup(self, "Qt options")
   304         group = optparse.OptionGroup(self, "Qt options")
   295         group.add_option("--qt-mobility", action="store_true", dest="qtmobility",
   305         group.add_option("--qt-mobility", action="store_true", dest="qtmobility",
   296                          help="Assumes that Qt Mobility is available without performing a compilation test.")
   306                          help="Assumes that Qt Mobility is available without performing a compilation test.")
   297         group.add_option("--no-qt-mobility", action="store_false", dest="qtmobility",
   307         group.add_option("--no-qt-mobility", action="store_false", dest="qtmobility",
   298                          help="Assumes that Qt Mobility is not available without performing a compilation test.")
   308                          help="Assumes that Qt Mobility is not available without performing a compilation test.")
   299         group.add_option("--meegotouch", action="store_true", dest="meegotouch",
       
   300                          help="Assumes that MeeGoTouch UI is available without performing a compilation test.")
       
   301         group.add_option("--no-meegotouch", action="store_false", dest="meegotouch",
       
   302                          help="Assumes that MeeGoTouch UI is not available without performing a compilation test.")
       
   303         group.add_option("--qt-openvg", action="store_true", dest="qtopenvg",
   309         group.add_option("--qt-openvg", action="store_true", dest="qtopenvg",
   304                          help="Assumes that OpenVG is available without performing a compilation test.")
   310                          help="Assumes that OpenVG is available without performing a compilation test.")
   305         group.add_option("--no-qt-openvg", action="store_false", dest="qtopenvg",
   311         group.add_option("--no-qt-openvg", action="store_false", dest="qtopenvg",
   306                          help="Assumes that OpenVG is not available without performing a compilation test.")
   312                          help="Assumes that OpenVG is not available without performing a compilation test.")
   307         self.add_option_group(group)
   313         self.add_option_group(group)
   482         self._docdir = None
   488         self._docdir = None
   483         self._includedir = None
   489         self._includedir = None
   484         self._pluginsdir = None
   490         self._pluginsdir = None
   485         self._featuresdir = None
   491         self._featuresdir = None
   486         self._resourcesdir = None
   492         self._resourcesdir = None
       
   493         self._translationsdir = None
   487 
   494 
   488     def init(self, options):
   495     def init(self, options):
   489         # prefix
   496         # prefix
   490         if options.prefix:
   497         if options.prefix:
   491             # explicit
   498             # explicit
   504         self._docdir = self._dir_option(options.docdir, self._prefix + "/doc")
   511         self._docdir = self._dir_option(options.docdir, self._prefix + "/doc")
   505         self._includedir = self._dir_option(options.includedir, self._prefix + "/include")
   512         self._includedir = self._dir_option(options.includedir, self._prefix + "/include")
   506         self._pluginsdir = self._dir_option(options.pluginsdir, self._prefix + "/plugins")
   513         self._pluginsdir = self._dir_option(options.pluginsdir, self._prefix + "/plugins")
   507         self._featuresdir = self._dir_option(options.featuresdir, QMAKE.features())
   514         self._featuresdir = self._dir_option(options.featuresdir, QMAKE.features())
   508         self._resourcesdir = self._dir_option(options.resourcesdir, self._prefix + "/resources")
   515         self._resourcesdir = self._dir_option(options.resourcesdir, self._prefix + "/resources")
       
   516         self._translationsdir = self._dir_option(options.translationsdir, self._prefix + "/translations")
   509 
   517 
   510         # symbian specific adjustments
   518         # symbian specific adjustments
   511         if QMAKE.platform() == "symbian":
   519         if QMAKE.platform() == "symbian":
       
   520             self._bindir = self._dir_option(options.bindir, "$${EPOCROOT}epoc32/tools")
       
   521 
   512             # TODO: fix to "$${EPOCROOT}resource/hb/plugins"
   522             # TODO: fix to "$${EPOCROOT}resource/hb/plugins"
   513             self._pluginsdir = "$${EPOCROOT}resource/qt/plugins/hb"
   523             self._pluginsdir = "$${EPOCROOT}resource/qt/plugins/hb"
   514 
   524 
   515             if not options.developer:
   525             if not options.developer:
   516                 if os.path.isdir("/s60"):
   526                 if os.path.isdir("/s60"):
   545     def featuresdir(self):
   555     def featuresdir(self):
   546         return self._featuresdir
   556         return self._featuresdir
   547 
   557 
   548     def resourcesdir(self):
   558     def resourcesdir(self):
   549         return self._resourcesdir
   559         return self._resourcesdir
       
   560 
       
   561     def translationsdir(self):
       
   562         return self._translationsdir
   550 
   563 
   551     def exportdir(self, category=None):
   564     def exportdir(self, category=None):
   552         if os.path.isdir("/s60"):
   565         if os.path.isdir("/s60"):
   553             if category:
   566             if category:
   554                 return "hb/%1/" + category + "/%2"
   567                 return "hb/%1/" + category + "/%2"
   713 
   726 
   714     # compilation tests to detect available features
   727     # compilation tests to detect available features
   715     config = ConfigFile()
   728     config = ConfigFile()
   716     test = ConfigTest(BUILDENV.sourcedir(), BUILDENV.builddir())
   729     test = ConfigTest(BUILDENV.sourcedir(), BUILDENV.builddir())
   717     print("\nDetecting available features...")
   730     print("\nDetecting available features...")
       
   731     working_qmake_and_make = test.compile("config.tests/all/simpleapp")
       
   732     print("INFO: Working qmake and make:\t\t%s" % working_qmake_and_make)
   718     if options.qtmobility == None:
   733     if options.qtmobility == None:
   719         options.qtmobility = test.compile("config.tests/all/mobility")
   734         options.qtmobility = test.compile("config.tests/all/mobility")
   720     if options.qtmobility:
   735     if options.qtmobility:
   721         config.add_value("DEFINES", "HB_HAVE_QT_MOBILITY")
   736         config.add_value("DEFINES", "HB_HAVE_QT_MOBILITY")
   722     print("INFO: Qt Mobility:\t\t\t%s" % options.qtmobility)
   737     print("INFO: Qt Mobility:\t\t\t%s" % options.qtmobility)
   736             config.add_value("DEFINES", "HB_HAVE_PROTECTED_CHUNK")
   751             config.add_value("DEFINES", "HB_HAVE_PROTECTED_CHUNK")
   737         touchfeedback_result = test.compile("config.tests/symbian/touchfeedback")
   752         touchfeedback_result = test.compile("config.tests/symbian/touchfeedback")
   738         if touchfeedback_result:
   753         if touchfeedback_result:
   739             config.add_value("DEFINES", "HB_TOUCHFEEDBACK_TYPE_IS_LONGPRESS")
   754             config.add_value("DEFINES", "HB_TOUCHFEEDBACK_TYPE_IS_LONGPRESS")
   740         print("INFO: ETouchFeedbackLongPress:\t\t%s" % touchfeedback_result)
   755         print("INFO: ETouchFeedbackLongPress:\t\t%s" % touchfeedback_result)
   741     if options.meegotouch == None:
   756         wsrenderorientation_result = test.compile("config.tests/symbian/wsrenderorientation")
   742         options.meegotouch = test.compile("config.tests/meego/meegotouch")
   757         if wsrenderorientation_result:
   743     if options.meegotouch:
   758             config.add_value("DEFINES", "HB_WSERV_HAS_RENDER_ORIENTATION")
   744         config.add_value("CONFIG", "hb_meegotouch")
   759         print("INFO: WServ render orientation support:\t%s" % wsrenderorientation_result)
   745         config.add_value("DEFINES", "HB_MEEGOTOUCH")
   760         pointerregion_result = test.compile("config.tests/symbian/pointerregion")
   746     print("INFO: MeeGo Touch:\t\t\t%s" % options.meegotouch)
   761         if pointerregion_result:
       
   762             config.add_value("DEFINES", "HB_RWND_HAS_POINTER_REGION")
       
   763         print("INFO: RWindowBase pointer region:\t%s" % pointerregion_result)
   747 
   764 
   748     config.set_value("HB_INSTALL_DIR", ConfigFile.format_dir(BUILDENV.prefix()))
   765     config.set_value("HB_INSTALL_DIR", ConfigFile.format_dir(BUILDENV.prefix()))
   749     config.set_value("HB_BIN_DIR", ConfigFile.format_dir(BUILDENV.bindir()))
   766     config.set_value("HB_BIN_DIR", ConfigFile.format_dir(BUILDENV.bindir()))
   750     config.set_value("HB_LIB_DIR", ConfigFile.format_dir(BUILDENV.libdir()))
   767     config.set_value("HB_LIB_DIR", ConfigFile.format_dir(BUILDENV.libdir()))
   751     config.set_value("HB_DOC_DIR", ConfigFile.format_dir(BUILDENV.docdir()))
   768     config.set_value("HB_DOC_DIR", ConfigFile.format_dir(BUILDENV.docdir()))
   752     config.set_value("HB_INCLUDE_DIR", ConfigFile.format_dir(BUILDENV.includedir()))
   769     config.set_value("HB_INCLUDE_DIR", ConfigFile.format_dir(BUILDENV.includedir()))
   753     config.set_value("HB_PLUGINS_DIR", ConfigFile.format_dir(BUILDENV.pluginsdir()))
   770     config.set_value("HB_PLUGINS_DIR", ConfigFile.format_dir(BUILDENV.pluginsdir()))
   754     config.set_value("HB_FEATURES_DIR", ConfigFile.format_dir(BUILDENV.featuresdir()))
   771     config.set_value("HB_FEATURES_DIR", ConfigFile.format_dir(BUILDENV.featuresdir()))
   755     config.set_value("HB_RESOURCES_DIR", ConfigFile.format_dir(BUILDENV.resourcesdir()))
   772     config.set_value("HB_RESOURCES_DIR", ConfigFile.format_dir(BUILDENV.resourcesdir()))
       
   773     config.set_value("HB_TRANSLATIONS_DIR", ConfigFile.format_dir(BUILDENV.translationsdir()))
   756 
   774 
   757     # TODO: get rid of this!
   775     # TODO: get rid of this!
   758     if QMAKE.platform() == "symbian":
   776     if QMAKE.platform() == "symbian":
   759         config.set_value("HB_PLUGINS_EXPORT_DIR", ConfigFile.format_dir("$${EPOCROOT}epoc32/winscw/c/resource/qt/plugins/hb"))
   777         config.set_value("HB_PLUGINS_EXPORT_DIR", ConfigFile.format_dir("$${EPOCROOT}epoc32/winscw/c/resource/qt/plugins/hb"))
   760 
   778 
   761     if options.gestures:
   779     # DEPRECATED options:
   762         config.add_value("DEFINES", "HB_GESTURE_FW")
   780     if options.gestures != None:
   763     if options.effects:
   781         print("WARNING: --no-gestures is DEPRECATED. Gestures are mandatory part of the Hb framework.")
   764         config.add_value("DEFINES", "HB_EFFECTS")
   782     if options.effects != None:
       
   783         print("WARNING: --no-effects is DEPRECATED. Effects are mandatory part of the Hb framework.")
       
   784     config.add_value("DEFINES", "HB_GESTURE_FW")
       
   785     config.add_value("DEFINES", "HB_EFFECTS")
       
   786 
   765     if options.textMeasurement:
   787     if options.textMeasurement:
   766         config.add_value("DEFINES", "HB_TEXT_MEASUREMENT_UTILITY")
   788         config.add_value("DEFINES", "HB_TEXT_MEASUREMENT_UTILITY")
   767     if QMAKE.platform() != "symbian" and options.developer:
   789     if QMAKE.platform() != "symbian" and options.developer:
   768         config.add_value("DEFINES", "HB_CSS_INSPECTOR")
   790         config.add_value("DEFINES", "HB_CSS_INSPECTOR")
       
   791     if options.define:
       
   792         for optdef in options.define:
       
   793             config.add_value("DEFINES", optdef)
   769     if options.defines:
   794     if options.defines:
   770         config.add_value("DEFINES", " ".join(options.defines.split(",")))
   795         config.add_value("DEFINES", " ".join(options.defines.split(",")))
   771     if options.developerexport:
   796     if options.developerexport:
   772         config.add_value("DEFINES", "HB_DEVELOPER")
   797         config.add_value("DEFINES", "HB_DEVELOPER")
   773     if options.rpath == None or options.rpath == True:
   798     if options.rpath == None or options.rpath == True:
   804 
   829 
   805     if BUILDENV.local():
   830     if BUILDENV.local():
   806         config.add_value("CONFIG", "local")
   831         config.add_value("CONFIG", "local")
   807     if options.silent:
   832     if options.silent:
   808         config.add_value("CONFIG", "silent")
   833         config.add_value("CONFIG", "silent")
   809     if options.effects:
       
   810         config.add_value("CONFIG", "effects")
       
   811     if options.gestures:
       
   812         config.add_value("CONFIG", "gestures")
       
   813     if options.developer:
   834     if options.developer:
   814         config.add_value("CONFIG", "developer")
   835         config.add_value("CONFIG", "developer")
   815     if options.coverage:
   836     if options.coverage:
   816         config.add_value("CONFIG", "coverage")
   837         config.add_value("CONFIG", "coverage")
       
   838     if options.release:
       
   839         config.add_value("CONFIG", "release")
       
   840     if options.debug:
       
   841         config.add_value("CONFIG", "debug")
       
   842     if options.debug_and_release:
       
   843         config.add_value("CONFIG", "debug_and_release")
   817     if options.config:
   844     if options.config:
   818         config.add_value("CONFIG", options.config)
   845         for optconf in options.config:
   819     if options.debug_output != None:
   846             config.add_value("CONFIG", optconf)
   820         config.add_value("CONFIG", "debug_output")
   847 
   821     if options.no_debug_output != None:
   848     if options.debug_output:
   822         config.add_value("CONFIG", "no_debug_output")
   849         config.add_value("DEFINES", "HB_DEBUG_OUTPUT")
   823 
   850         config.add_value("DEFINES", "HB_WARNING_OUTPUT")
   824     # debug & warning outputs:
   851     if options.no_debug_output:
   825     #   - release
   852         config.add_value("DEFINES", "HB_NO_DEBUG_OUTPUT")
   826     #       - disabled by default
   853         config.add_value("DEFINES", "HB_NO_WARNING_OUTPUT")
   827     #       - can be enabled by passing --debug_output option
       
   828     #   - debug
       
   829     #       - enabled by default
       
   830     #       - can be disabled by passing --no_debug_output option
       
   831     config._lines.append("CONFIG(release, debug|release) {\n")
       
   832     config._lines.append("    debug_output|developer {\n")
       
   833     config._lines.append("        # debug/warning output enabled\n")
       
   834     config._lines.append("    } else {\n")
       
   835     config._lines.append("        DEFINES += QT_NO_DEBUG_OUTPUT\n")
       
   836     config._lines.append("        DEFINES += QT_NO_WARNING_OUTPUT\n")
       
   837     config._lines.append("    }\n")
       
   838     config._lines.append("} else {\n")
       
   839     config._lines.append("    no_debug_output {\n")
       
   840     config._lines.append("        DEFINES += QT_NO_DEBUG_OUTPUT\n")
       
   841     config._lines.append("        DEFINES += QT_NO_WARNING_OUTPUT\n")
       
   842     config._lines.append("    }\n")
       
   843     config._lines.append("}\n")
       
   844 
   854 
   845     # ensure that no QString(0) -like constructs slip in
   855     # ensure that no QString(0) -like constructs slip in
   846     config.add_value("DEFINES", "QT_QCHAR_CONSTRUCTOR")
   856     config.add_value("DEFINES", "QT_QCHAR_CONSTRUCTOR")
   847 
   857 
       
   858     # expose a flag indicating that tools were built with a host toolchain
       
   859     if options.hostqmakebin != None and options.hostmakebin != None:
       
   860         config.add_value("CONFIG", "host_tools")
       
   861 
   848     # TODO: is there any better way to expose functions to the whole source tree?
   862     # TODO: is there any better way to expose functions to the whole source tree?
   849     config._lines.append("include(%s)\n" % (os.path.splitdrive(BUILDENV.sourcedir())[1] + "/mkspecs/hb_functions.prf"))
   863     config._lines.append("include(%s)\n" % ConfigFile.format_dir((os.path.splitdrive(BUILDENV.sourcedir())[1]) + "/mkspecs/hb_functions.prf"))
   850 
   864 
   851     if options.verbose:
   865     if options.verbose:
   852         print("INFO: Writing .qmake.cache")
   866         print("INFO: Writing .qmake.cache")
   853     if not config.write(".qmake.cache"):
   867     if not config.write(".qmake.cache"):
   854         print("ERROR: Unable to write .qmake.cache.")
   868         print("ERROR: Unable to write .qmake.cache.")
   855         return
   869         return
   856 
       
   857     if os.name == "posix" or os.name == "mac":
       
   858         sharedmem = test.compile("config.tests/unix/sharedmemory")
       
   859         if sharedmem:
       
   860             (code, output) = run_process(["./hbconftest_sharedmemory"], "config.tests/unix/sharedmemory")
       
   861             sharedmem = (code == 0)
       
   862             if not sharedmem:
       
   863                 print("DEBUG:%s" % output)
       
   864         print("INFO: Shared Memory:\t\t\t%s" % sharedmem)
       
   865         if not sharedmem:
       
   866             print("WARNING:The amount of available shared memory is too low!")
       
   867             print "\tTry adjusting the shared memory configuration",
       
   868             if os.path.exists("/proc/sys/kernel/shmmax"):
       
   869                 print "(/proc/sys/kernel/shmmax)"
       
   870             elif os.path.exists("/etc/sysctl.conf"):
       
   871                 print "(/etc/sysctl.conf)"
       
   872 
   870 
   873     # generate local build wrapper headers
   871     # generate local build wrapper headers
   874     print("\nGenerating files...")
   872     print("\nGenerating files...")
   875     print("INFO: Wrapper headers")
   873     print("INFO: Wrapper headers")
   876     synchb = "bin/synchb.py"
   874     synchb = "bin/synchb.py"
   991                         line = "".ljust(maxlen + 2)
   989                         line = "".ljust(maxlen + 2)
   992                 if len(line) > init:
   990                 if len(line) > init:
   993                     print line
   991                     print line
   994             print "###############################################################################"
   992             print "###############################################################################"
   995 
   993 
       
   994     if not working_qmake_and_make:
       
   995         print("")
       
   996         print("WARNING: There does not seem to be a working qmake and/or make in the environment.")
       
   997         print("         Please check the environment and/or configuration parameters.")
       
   998 
   996     # print summary
   999     # print summary
   997     print("")
  1000     print("")
   998     if MAKE.bin() == "nmake" and options.msvc:
  1001     if MAKE.bin() == "nmake" and options.msvc:
   999         conf = "MSVC"
  1002         conf = "MSVC"
  1000         act = "open 'hb.sln'"
  1003         act = "open 'hb.sln'"