trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: March 2012

Build split package for sip4-tqt & provide Python2 and Python3 support

From: "David C. Rankin" <drankinatty@...>
Date: Thu, 22 Mar 2012 09:10:28 -0500
Darrel, All,

  After examining the way Arch handled the building and installation of sip and
python2-sip, I believe the same can be applied to the sip4-tqt package to build
and provide both python2 and python3 support. I have setup the arch build of
sip4-tqt to do this. It can probably be done the exact same for all distros. The
build proceeds as follows:

pkgbase=tde-sip4-tqt
pkgname=('tde-sip' "${pkgbase}")

build() {
  CFLAGS="${CFLAGS} -I/usr/include/tqt -I${TDEDIR}/include -I${QTDIR}/include"
  cd ${srcdir}  # the directory holding sip4-tqt source dir

  ## copy source for Python3 build
  cp -r ${pkgbase#*-} sipPy3

  ## Python3 version
  cd ${srcdir}/sipPy3
  python configure.py CFLAGS="${CFLAGS}" LFLAGS="${LDFLAGS}"
  make

  ## Python2 version
  cd ${srcdir}/${pkgbase#*-}
  python2 configure.py CFLAGS="${CFLAGS}" LFLAGS="${LDFLAGS}"
  make
}

## package Python3 version as 'tde-sip'
package_tde-sip() {
  pkgdesc="The TDE SIP C/C++ Bindings Generator for Python3 - Trinity upstream
GIT version"
  depends=('python')
  replaces=('python-sip' 'sip')
  provides=('python-sip' 'sip')

  cd "${srcdir}/sipPy3"
  make DESTDIR="${pkgdir}" install

  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

## package Python2 version as 'tde-sip4-tqt'
package_tde-sip4-tqt() {
  pkgdesc="The TDE SIP C/C++ Bindings Generator for Python2 - Trinity upstream
GIT version"
  depends=('sip' 'python2')
  replaces=('python2-sip')
  provides=('python2-sip')

  cd "${srcdir}/${pkgbase#*-}"
  make DESTDIR="${pkgdir}" install

  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

  # Provided by tde-sip
  rm "${pkgdir}/usr/bin/sip"
}

  The resulting packages avoid the /usr/bin/sip conflict by removing the version
produced by python2 in the package stage resulting in packages that install
nicely together. The file list provided is:

08:57 nirvana:~/tde/bld/tde-sip4-tqt> pacman -Qpl
tde-sip4-tqt-3513_tqt-2-x86_64.pkg.tar.xz
tde-sip4-tqt /usr/
tde-sip4-tqt /usr/bin/
tde-sip4-tqt /usr/include/
tde-sip4-tqt /usr/include/python2.7/
tde-sip4-tqt /usr/include/python2.7/sip.h
tde-sip4-tqt /usr/lib/
tde-sip4-tqt /usr/lib/python2.7/
tde-sip4-tqt /usr/lib/python2.7/site-packages/
tde-sip4-tqt /usr/lib/python2.7/site-packages/sip.so
tde-sip4-tqt /usr/lib/python2.7/site-packages/sipconfig.py
tde-sip4-tqt /usr/lib/python2.7/site-packages/sipdistutils.py
tde-sip4-tqt /usr/share/
tde-sip4-tqt /usr/share/licenses/
tde-sip4-tqt /usr/share/licenses/tde-sip4-tqt/
tde-sip4-tqt /usr/share/licenses/tde-sip4-tqt/LICENSE

08:58 nirvana:~/tde/bld/tde-sip4-tqt> pacman -Qpl
tde-sip-3513_tqt-2-x86_64.pkg.tar.xz
tde-sip /usr/
tde-sip /usr/bin/
tde-sip /usr/bin/sip
tde-sip /usr/include/
tde-sip /usr/include/python3.2mu/
tde-sip /usr/include/python3.2mu/sip.h
tde-sip /usr/lib/
tde-sip /usr/lib/python3.2/
tde-sip /usr/lib/python3.2/site-packages/
tde-sip /usr/lib/python3.2/site-packages/sip.so
tde-sip /usr/lib/python3.2/site-packages/sipconfig.py
tde-sip /usr/lib/python3.2/site-packages/sipdistutils.py
tde-sip /usr/share/
tde-sip /usr/share/licenses/
tde-sip /usr/share/licenses/tde-sip/
tde-sip /usr/share/licenses/tde-sip/LICENSE

  May be worth looking at for other distros as well.

-- 
David C. Rankin, J.D.,P.E.