Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1033

Improve the shiboken build process

    XMLWordPrintable

Details

    • User Story
    • Resolution: Fixed
    • P2: Important
    • 6.3.0
    • 5.13.2
    • Shiboken
    • None
    • All
    • 5d0fd24f0ff9289dba2d41a38a7054770c3a3eee

    Description

      Problem:
      While adding support for cross compiling options I noticed the current
      setup of the build process could be improved.

      Since the wheel-split changes we currently generate three packages:

      • Shiboken generator
      • Shiboken (python module)
      • PySide (python module)

      Which makes sense, but sadly we cannot build Shiboken separately
      in a proper way, i.e.: building shiboken generator also builds the python
      module, and some Linux distributions that are maintaining the separate
      packages are manually removing the files that are not interesting.

      For example, Arch Linux's packages.
      from which you can see the following while building shiboken:

      build() {
        cd build
        cmake ../${_pkgfqn}/sources/shiboken2 \
          -DCMAKE_INSTALL_PREFIX=/usr \
          -DBUILD_TESTS=OFF \
          -DUSE_PYTHON_VERSION=3
        make
      }
      
      package_shiboken2() {
        depends=(clang=$_clangver llvm libxslt qt5-xmlpatterns)
      
        cd build
        make DESTDIR="$pkgdir" install
      # Provided in python-shiboken2
        rm -r "$pkgdir"/usr/lib/{python*,libshiboken*}
      }
      
      package_python-shiboken2() {
        depends=(python)
      
        cd build
        make DESTDIR="$pkgdir" install
      # Provided in shiboken2
        rm -r "$pkgdir"/usr/{bin,include,lib/{cmake,pkgconfig},share}
      }
      

      When they build shiboken 2 (the generator), they need to remove all the
      shared libraries that are generated too:

      rm -r "$pkgdir"/usr/lib/{python*,libshiboken*}
      

      and then when building the python module, they need to remove the
      shiboken generator files:

      rm -r "$pkgdir"/usr/{bin,include,lib/{cmake,pkgconfig},share}
      

      This is crucial for cross compiling purposes because one needs to build
      the generator on the Host, and then build the python module for the
      Target but using the Host generator and a specified sysroot.

      Solution:
      At the moment the CMake configuration to build shiboken needs some
      love, but a split is not straightforward because many sub-directories
      are being built:

      • ApiExtractor
      • libshiboken
      • doc
      • generator
      • shibokenmodule
      • tests
      • data

      I believe completely separating the building process of Shiboken generator
      and Shiboken module (python) is crucial to achieve any kind of cross compiling
      setup.

      1. Building Shiboken generator should contain:

      • ApiExtractor,
      • doc (only from ApiExtractor)
      • generator
      • tests (without the shibokenmodule)

      2. Building Shiboken module (python) should contain

      • libshiboken
      • shibokenmodule
      • doc (only from shibokenmodule)
      • tests (only the shibokenmodule one)

      Notice that for step 2. we would need a mechanism to specify the
      path to the generator to be used.

      The data directory contains CMake Config files that will need to be
      split too to properly found the generator and the module as separate
      things.
      We could even write a third one that include boths to not alter the
      current build process.

      Attachments

        Issue Links

          For Gerrit Dashboard: PYSIDE-1033
          # Subject Branch Project Status CR V

          Activity

            People

              alexandru.croitor Alexandru Croitor
              crmaurei Cristian Maureira-Fredes
              Alex Blasche Alex Blasche
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: