ports/devel/py-qt4-core/files/patch-configure.py
Raphael Kubo da Costa c3f9087c48 Update PyQt to 4.11.1, QScintilla to 2.8.3 and SIP to 4.16.2.
... And bump PORTREVISION on ports that depend on devel/qscintilla2 due to
the shlib version change.

This is brought to you by the KDE on FreeBSD team. Besides updating to newer
upstream releases, this commit also contains a lot of under-the-hood changes
to the PyQt/QScintilla/SIP ports. Their Makefiles had accumulated a lot of
cruft over time, so it was time for some summer cleaning:

- General, belated changes:
  * Use OPTIONS helpers wherever possible, stop including
    <bsd.port.options.mk> when not necessary, stop checking for
    ${PORT_OPTIONS:MDOCS} and ${PORT_OPTIONS:MEXAMPLES} when not necessary,
    add options such as DOCS and/or DEBUG where they were only checked for.

- QScintilla ports:
  * Drop the API option from py-qt4-qscintilla2. It had been broken ever
    since staging support was added, and its existence does not make much
    sense: QScintilla is a hard dependency regardless of the state of this
    option anyway, they all come from the same tarball and the configuration
    script assumes the .api file will always be installed.

- PyQt ports:
  * The configure.py patch shared by all PyQt ports has been trimmed down to
    the minimum. Changes for Qt3 compatibility or for things that are just
    not needed anymore have been removed.

  * Several post-configure targets in the PyQt ports have been removed, as
    they had no effect on the way the ports were built whatsoever.

  * In some cases, instead of calling Python's py_compile.py on `ls *.py
    */*.py */*/*.py` to generate .pyc and .pyo files, we just call
    compileall.py, which is made for this kind of task.

  * The patch + sed hack to build py-qt4-dbussupport has been replaced by
    only extracting the dbus/ directory for that port and excluding it from
    all others.

  * Move the bulk of the code in all Makefiles to bsd.pyqt.mk, like the
    non-Python Qt ports do with bsd.qt.mk and the QT_DIST variable. A large
    portion of all PyQt Makefiles were very similar and contained a lot of
    boilerplate code that can be shared among all of them since they all
    come from the same tarball. bsd.pyqt.mk now has a PYQT4_DIST variable
    that, when set, automatically sets several common variables and the
    do-configure target for a port. This allows us to considerably reduce
    the size of all the py-qt4-* Makefiles.

  * To make the above possible and also to allow us to use as many OPTIONS
    helpers as possible, the ARGS variable is now called CONFIGURE_ARGS.
    That's what it was used for anyway.

PR:		191990
2014-07-23 19:53:11 +00:00

229 lines
8.6 KiB
Python

--- configure.py.orig 2014-07-03 17:00:02.000000000 +0300
+++ configure.py 2014-07-19 23:51:03.000000000 +0300
@@ -343,7 +343,7 @@
# Note that the order in which we check is important for the
# consolidated module - a module's dependencies must be checked first.
- pyqt_modules.append("QtCore")
+ check_module("QtCore", "qobject.h", "new QObject()")
check_module("QtGui", "qwidget.h", "new QWidget()")
check_module("QtHelp", "qhelpengine.h", "new QHelpEngine(\"foo\")")
@@ -372,8 +372,8 @@
check_module("QtTest", "QtTest", "QTest::qSleep(0)")
check_module("QtWebKit", "qwebpage.h", "new QWebPage()")
check_module("QtXmlPatterns", "qxmlname.h", "new QXmlName()")
- check_module("phonon", "phonon/videowidget.h",
- "new Phonon::VideoWidget()")
+ check_module("phonon", "phonon/mediacontroller.h",
+ "new Phonon::MediaController(0)")
check_module("QtAssistant", "qassistantclient.h",
"new QAssistantClient(\"foo\")", extra_lib_dirs=ass_lib_dirs,
extra_libs=ass_libs)
@@ -635,21 +635,6 @@
if opts.staticplugins:
sipconfig.inform("Unable to find the following static plugins: %s" % ", ".join(opts.staticplugins))
- # Generate the QScintilla API file.
- sipconfig.inform("Creating QScintilla API file...")
- f = open("PyQt4.api", "w")
-
- for m in pyqt_modules:
- api = open(m + ".api")
-
- for l in api:
- f.write("PyQt4." + l)
-
- api.close()
- os.remove(m + ".api")
-
- f.close()
-
def _qpy_directories(self, mname, lib_name):
"""Return a 3-tuple of the directories containing the header files, the
directory containing the library, and the name of the support library
@@ -740,6 +725,9 @@
return libs, libdirs
def module_installs(self):
+ if "QtCore" not in pyqt_modules:
+ return []
+
return [os.path.join(src_dir, "__init__.py"), "pyqtconfig.py"]
def qpy_libs(self):
@@ -875,80 +863,82 @@
makefile.generate()
tool.append("elementtree")
- # Create the pyuic4 wrapper. Use the GUI version on MacOS (so that
- # previews work properly and normal console use will work anyway), but
- # not on Windows (so that normal console use will work).
- sipconfig.inform("Creating pyuic4 wrapper...")
+ if "QtCore" in pyqt_modules:
+ # Create the pyuic4 wrapper. Use the GUI version on MacOS (so that
+ # previews work properly and normal console use will work anyway), but
+ # not on Windows (so that normal console use will work).
+ sipconfig.inform("Creating pyuic4 wrapper...")
- if sys.platform == 'darwin':
- gui = True
+ if sys.platform == 'darwin':
+ gui = True
- if opts.use_arch is None:
- use_arch = ''
+ if opts.use_arch is None:
+ use_arch = ''
+ else:
+ use_arch = ' '.join(opts.use_arch)
else:
- use_arch = ' '.join(opts.use_arch)
- else:
- gui = False
- use_arch = ''
+ gui = False
+ use_arch = ''
- # The pyuic directory may not exist if we are building away from the
- # source directory.
- try:
- os.mkdir("pyuic")
- except OSError:
- pass
+ # The pyuic directory may not exist if we are building away from the
+ # source directory.
+ try:
+ os.mkdir("pyuic")
+ except OSError:
+ pass
- uicdir=os.path.join(pyqt_modroot, "uic")
- wrapper = sipconfig.create_wrapper(os.path.join(uicdir, "pyuic.py"), os.path.join("pyuic", "pyuic4"), gui, use_arch)
+ uicdir=os.path.join(pyqt_modroot, "uic")
+ wrapper = sipconfig.create_wrapper(os.path.join(uicdir, "pyuic.py"), os.path.join("pyuic", "pyuic4"), gui, use_arch)
- sipconfig.inform("Creating pyuic4 Makefile...")
+ sipconfig.inform("Creating pyuic4 Makefile...")
- makefile = sipconfig.PythonModuleMakefile(
- configuration=sipcfg,
- dstdir=uicdir,
- srcdir=os.path.join(src_dir, "pyuic", "uic"),
- dir="pyuic",
- installs=[[os.path.basename(wrapper), opts.pyqtbindir]]
- )
+ makefile = sipconfig.PythonModuleMakefile(
+ configuration=sipcfg,
+ dstdir=uicdir,
+ srcdir=os.path.join(src_dir, "pyuic", "uic"),
+ dir="pyuic",
+ installs=[[os.path.basename(wrapper), opts.pyqtbindir]]
+ )
- makefile.generate()
- tool.append("pyuic")
+ makefile.generate()
+ tool.append("pyuic")
- sipconfig.inform("Creating pylupdate4 Makefile...")
+ if "QtXml" in pyqt_modules:
+ sipconfig.inform("Creating pylupdate4 Makefile...")
- cxxflags_app = sipcfg.build_macros().get("CXXFLAGS_APP", "")
+ cxxflags_app = sipcfg.build_macros().get("CXXFLAGS_APP", "")
- makefile = sipconfig.ProgramMakefile(
- configuration=sipcfg,
- build_file=os.path.join(src_dir, "pylupdate", "pylupdate.sbf"),
- dir="pylupdate",
- install_dir=opts.pyqtbindir,
- console=1,
- qt=["QtCore", "QtXml"],
- debug=opts.debug,
- warnings=1,
- universal=sipcfg.universal,
- arch=sipcfg.arch,
- deployment_target=sipcfg.deployment_target
- )
-
- makefile.extra_include_dirs.append(os.path.join(src_dir, "pylupdate"))
-
- if cxxflags_app != "":
- makefile.extra_cxxflags.append(cxxflags_app)
-
- makefile.generate()
- tool.append("pylupdate")
-
- sipconfig.inform("Creating pyrcc4 Makefile...")
+ makefile = sipconfig.ProgramMakefile(
+ configuration=sipcfg,
+ build_file=os.path.join(src_dir, "pylupdate", "pylupdate.sbf"),
+ dir="pylupdate",
+ install_dir=opts.pyqtbindir,
+ console=1,
+ qt=["QtCore", "QtXml"],
+ debug=opts.debug,
+ warnings=1,
+ universal=sipcfg.universal,
+ arch=sipcfg.arch,
+ deployment_target=sipcfg.deployment_target
+ )
+
+ makefile.extra_include_dirs.append(os.path.join(src_dir, "pylupdate"))
+
+ if cxxflags_app != "":
+ makefile.extra_cxxflags.append(cxxflags_app)
+
+ makefile.generate()
+ tool.append("pylupdate")
- makefile = pyrccMakefile()
+ sipconfig.inform("Creating pyrcc4 Makefile...")
- if cxxflags_app != "":
- makefile.extra_cxxflags.append(cxxflags_app)
+ makefile = pyrccMakefile()
- makefile.generate()
- tool.append("pyrcc")
+ if cxxflags_app != "":
+ makefile.extra_cxxflags.append(cxxflags_app)
+
+ makefile.generate()
+ tool.append("pyrcc")
if opts.designer_plugin and "QtDesigner" in pyqt_modules:
py_major = sipcfg.py_version >> 16
@@ -975,9 +965,6 @@
# include the ABI information.
abi = ""
else:
- dynamic_pylib = "--enable-shared" in config_args
-
- if dynamic_pylib:
if glob.glob("%s/lib/libpython%d.%d*" % (ducfg["exec_prefix"], py_major, py_minor)):
lib_dir_flag = quote("-L%s/lib" % ducfg["exec_prefix"])
elif 'MULTIARCH' in ducfg and glob.glob('%s/lib/%s/libpython%d.%d*' % (ducfg['exec_prefix'], ducfg['MULTIARCH'], py_major, py_minor)):
@@ -990,9 +977,6 @@
opts.designer_plugin = False
link = "%s -lpython%d.%d%s" % (lib_dir_flag, py_major, py_minor, abi)
- else:
- sipconfig.inform("Qt Designer plugin disabled because Python library is static")
- opts.designer_plugin = False
pysh_lib = ducfg.get("LDLIBRARY", "")
@@ -2301,9 +2285,9 @@
installs=[(pyqt.module_installs(), pyqt_modroot)]
if opts.api:
- installs.append(("PyQt4.api", os.path.join(opts.qscidir, "api", "python")))
+ installs.append(("%s.api" % pyqt_modules[-1], os.path.join(opts.qscidir, "api", "python")))
- xtra_modules = ["Qt"]
+ xtra_modules = []
if opts.bigqt:
xtra_modules.append("_qt")