Menu

Build without patching

2017-08-16
2017-10-05
  • Joerg Kreuzberger

    Hi!

    I want to build PythonQt without any additional patching of source files.
    Therefore it might be a good idea to
    configure variables via environment or
    configure variables via .qmake.cache

    prf's, pri's and so on must then check if variables exist, before setting default values.
    Attached is a patch for python.prf where the value comes from the environment

    To link on link i had to external define the path to the python library. It could be determined by the python-config value --ldflags instead of --libs only

    Attached is a patch for the changes

    --- pythonqt-code/build/python.prf
    +++ pythonqt-code-patched/build/python.prf
    @@ -1,8 +1,13 @@
     # profile to include and link Python
    
     # Change this variable to your python version (2.6, 2.7, 3.3, ...)
    -win32:PYTHON_VERSION=27
    -unix:PYTHON_VERSION=2.7
    +
    +PYTHON_VERSION=$$(PYTHON_VERSION)
    +isEmpty( PYTHON_VERSION ) {
    +  win32:PYTHON_VERSION=27
    +  unix:PYTHON_VERSION=2.7
    +}
    +
    
     macx {
       # for macx you need to have the Python development kit installed as framework
    @@ -36,6 +41,6 @@
       # on linux, python-config is used to autodetect Python.
       # make sure that you have installed a matching python-dev package.
    
    -  unix:LIBS += $$system(python$${PYTHON_VERSION}-config --libs)
    +  unix:LIBS += $$system(python$${PYTHON_VERSION}-config --ldflags )
       unix:QMAKE_CXXFLAGS += $$system(python$${PYTHON_VERSION}-config --includes)
     }
    
     
  • Joerg Kreuzberger

    Attachments seem to be possible on post, but not on topic create

     
  • Joerg Kreuzberger

    patches are horrible to maintain cause the default line endings seems CRLF. Would it not be nicer to set default lineending to LF and let svn convert lineendings depending on OS checking out?

     
    • Florian Link

      Florian Link - 2017-08-21

      native eol was missing on the .prf/.pri files, I adapted them.

       
  • Erik Lundin

    Erik Lundin - 2017-08-19

    Joerg, the first part of the patch is exactly what I currently do in the Debian build scripts I'm working on. Would of course be better if this was fixed directly here. Good!

     
  • Florian Link

    Florian Link - 2017-08-20

    I will add that, any improvements to the build scripts are welcome, I don't use them myself because we have our own build system... regarding the line endings, I was not aware of the, will make them native eol.

     
  • Florian Link

    Florian Link - 2017-08-21

    I merged your patch.

     
  • Joerg Kreuzberger

    Thanks for merging. Much people prefer using cmake for building and there are a lot of projects adding cmake support to PythonQt.
    So if you do not use the qmake scripts and they are used just for "historical" reasons would it be a problem to merge cmake support e.g. from
    https://github.com/commontk/PythonQt
    to the svn repo?

     
  • Florian Link

    Florian Link - 2017-09-04

    Well, we do use qmake, we just don't use the build/ scripts.

    The problem is the maintenance... I already had those CMake files in the svn repo but then came the Qt5 port and nobody was willing to port the CMake version... And the Cmake version had different configuration options etc. and was jot able to build the generator correctly.

    So, long story short: I can add the Cmake file again, now that is seems to support Qt5, but I am not willing to provide maintenance for it (nor do I have time for that). If someone steps up and is willing to maintain it, that would be great! I can also add that person as a developer to the sf project so he can commit to svn directly.

     
  • Joerg Kreuzberger

    i think maintainance should be possible and maybe could be done by myself if allowed (company context, have to ask for time for it). Maybe would it be possible to host it at github? That would make the whole process of applying patches and changes more comfortable i think?

    During the last 3 days i made these changes to the 3.2 Version. Some were already integrated, but modified again to fix some issues. works for me on ubuntu 16.04 and visual studio 2015

     
  • Joerg Kreuzberger

    Hi!

    I finalized my work and tested if via the trunk version of today.
    i made an out of source build with QT and found other optimizations in the build.prf files due to shadow builds.

    Attached is the patch i made with svn diff from my linux system. It explicitly removes dos line endings in files where they still were found.

    The build is made on linux with custom Qt 5.9.1

    qmake was called i SHADOW dir with just the PythonQtAll libraries i require. Call for debug version here as example:

    qmake ../pythonqt-code/PythonQt.pro CONFIG+=debug CONFIG-=release PYTHONQTALL_CONFIG+=PythonQtCore PYTHONQTALL_CONFIG+=PythonQtGui
    

    Thanks for your support the last days.

     
  • Erik Lundin

    Erik Lundin - 2017-09-30

    Regarding configure_python.patch, how about removing the line PYTHON_VERSION=$$(PYTHON_VERSION)? Then PYTHON_VERSION can be selected by setting it as a parameter to qmake instead of exporting it as an environment variable.

     
  • Joerg Kreuzberger

    would be ok for me, too.

     
  • Florian Link

    Florian Link - 2017-10-18

    I merged your patch, but have no time to test it. Maybe someone can try it on Windows?
    Regarding the PYTHON_VERSION, there are more environment variables and it is also documented how to set them, so I don't want to change that atm.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.