[buildout]
extends =
  ../xorg/buildout.cfg
  ../gcc/buildout.cfg
  ../openssl/buildout.cfg
  ../dbus/buildout.cfg
  ../gtk-2/buildout.cfg

parts =
  qt4-qmake

[qt5-qmake]
# XXX work on all systems needs check
recipe = slapos.recipe.cmmi
location = ${buildout:parts-directory}/${:_buildout_section_name_}
#url = http://download.qt.io/official_releases/qt/5.6/5.6.2/submodules/qtbase-opensource-src-5.6.2.tar.gz
#md5sum = 7aa5841b50c411e23e31e8a6cc1c6981
url = http://download.qt.io/official_releases/qt/5.13/5.13.1/submodules/qtbase-everywhere-src-5.13.1.tar.xz
md5sum = 0a1761145531b74fff5b4d9a80c7b1c2
configure-command = ./configure
configure-options =
  --prefix=${:location}
  -v
  -gui
  -widgets
  -no-separate-debug-info
  -developer-build
  -confirm-license
  -opensource
  -no-opengl
  -nomake examples
  -no-dbus
#  -qt-xkbcommon-x11
#  -qt-xcb
#  -no-pulseaudio
#  -no-gtkstyle
  -no-pch
environment =
  PATH=${pkgconfig:location}/bin:${gcc:location}/bin:%(PATH)s
  PKG_CONFIG_PATH=${libxml2:location}/lib/pkgconfig:${openssl:location}/lib/pkgconfig
  CPPFLAGS=-I${libX11:location}/include -I${xproto:location}/include -I${libXext:location}/include -I${zlib:location}/include -I${pcre:location}/include -I${openssl:location}/include
  LDFLAGS=-L${gcc:location}/lib -Wl,-rpath=${gcc:location}/lib -L${gcc:location}/lib64 -Wl,-rpath=${gcc:location}/lib64 -L${libX11:location}/lib -Wl,-rpath=${libX11:location}/lib -L${xproto:location}/lib -Wl,-rpath=${xproto:location}/lib -L${libXext:location}/lib -Wl,-rpath=${libXext:location}/lib -L${libxcb:location}/lib -Wl,-rpath=${libxcb:location}/lib -L${zlib:location}/lib -Wl,-rpath -Wl,${zlib:location}/lib -Wl,-rpath=${pcre:location}/lib -L${openssl:location}/lib
#make-binary = true
make-binary= make -j4
#make-targets = install
# module-qttools 
post-install =
#  cd ${:location}/lib/pkgconfig/ 
#  ln -s ./Qt5Core.pc ./QtCore.pc
#  ln -s ./Qt5GUI.pc ./QtGUI.pc
#  ln -s ./Qt5Network.pc ./QtNetwork.pc
#  mkdir -p ${:location}/bin
#  mv -t ${:location}/bin bin/qmake
#  mv -t ${:location} mkspecs

[qt5-tools]
recipe = slapos.recipe.cmmi
url = http://download.qt.io/official_releases/qt/5.13/5.13.1/submodules/qttools-everywhere-src-5.13.1.tar.xz
#url = http://download.qt.io/archive/qt/5.6/5.6.2/submodules/qttools-opensource-src-5.6.2.tar.xz
md5sum = c57db5b2c95aa0ccf5637d9807a2f914
#md5sum = c877fc8f47089d0e5f859090a623774d
configure-command =
  ${qt5-qmake:location}/bin/qmake
make-binary = PREFIX=${buildout:parts-directory}/${:_buildout_section_name_} make
environment =
  PATH=${qt5-qmake:location}/bin:%(PATH)s

[qt5.6-qmake]
<= qt5-qmake
[qt5.6.2-qmake]
<= qt5.6-qmake


[qt4-qmake]
# building [qmake] will download the full qt source anyway ~200MB
# qmake binary can be reached directly from ${qt:location}/bin/qmake if [qt] is fully built
recipe = slapos.recipe.cmmi
location = ${buildout:parts-directory}/${:_buildout_section_name_}
url = https://download.qt.io/archive/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz
md5sum = d990ee66bf7ab0c785589776f35ba6ad
# see https://github.com/NixOS/nixpkgs/blob/3e387c3e005c87566b5403d24c86f71f4945a79b/pkgs/development/libraries/qt-4.x/4.8/default.nix#L101
version = 4.8.7
pre-configure =
  set -e -x
  sed 's,/usr/X11R6/lib64,${libX11:location}/lib64 ${xproto:location}/lib64 ${libXext:location}/lib64,g' -i mkspecs/*/*.conf
  sed 's,/usr/X11R6/lib,${libX11:location}/lib ${xproto:location}/lib ${libXext:location}/lib,g' -i mkspecs/*/*.conf
  sed 's,/usr/X11R6/include,${libX11:location}/include ${xproto:location}/include ${libXext:location}/include,g' -i mkspecs/*/*.conf
#  sed 's,/usr/local/include,${openssl-1.0:location}/include,g' -i mkspecs/*/*.conf
#  sed 's,/usr/local/lib,${openssl-1.0:location}/lib,g' -i mkspecs/*/*.conf
configure-command = ./configure --prefix=${:location} -v -no-separate-debug-info -release -no-fast -confirm-license -opensource -dbus -glib -gtkstyle -no-pch -no-rpath -nomake demos -nomake examples -nomake docs -graphicssystem raster -no-xvideo -no-xinerama -no-xshape -no-xsync  $CPPFLAGS -L${gettext:location}/lib
#make-targets = qmake

#post-install =
#  cp -rt ${:location}
environment =
  PATH=${pkgconfig:location}/bin:${gcc:location}/bin:%(PATH)s
  PKG_CONFIG_PATH=${openssl-1.0:location}/lib/pkgconfig:${dbus:location}/lib/pkgconfig:${glib:location}/lib/pkgconfig:${gtk-2:location}/lib/pkgconfig:${gtk-2:pkg_config_depends}
  CPPFLAGS=-I${openssl-1.0:location}/include -I${glib:location}/include/glib-2.0 -I${glib:location}/lib/glib-2.0/include -I${gtk-2:location}/include/gtk-2.0 -I${kbproto:location}/include/ -I${inputproto:location}/include/ -I${libXi:location}/include/ -I${libXrandr:location}/include/ -I${libXcursor:location}/include/ -I${xfixes:location}/include/ -I${fixesproto:location}/include/ -I${renderproto:location}/include/ -I${glproto:location}/include/

  LDFLAGS=-L${gcc:location}/lib -Wl,-rpath=${gcc:location}/lib -L${gcc:location}/lib64 -Wl,-rpath=${gcc:location}/lib64 -L${openssl-1.0:location}/lib -Wl,-rpath=${openssl-1.0:location}/lib -L${glib:location}/lib -Wl,-rpath=${glib:location}/lib -L${gtk-2:location}/lib -Wl,-rpath=${gtk-2:location}/lib -L${gettext:location}/lib -Wl,-rpath=${gettext:location}/lib  -Wl,-rpath=${:location}/lib -Wl,-rpath=${fontconfig:location}/lib -L${libXi:location}/lib -L${libXcursor:location}/lib -L${libXrandr:location}/lib -L${xfixes:location}/lib -L${libX11:location}/lib -L${libX11:location}/lib64 -Wl,-rpath=${libX11:location}/lib64  -Wl,-rpath=${libX11:location}/lib -L${libXext:location}/lib -Wl,-rpath=${libXext:location}/lib  -L${freetype:location}/lib -Wl,-rpath=${freetype:location}/lib  -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib -L${libpng:location}/lib -Wl,-rpath=${libpng:location}/lib 


  LD_LIBRARY_PATH=${:location}__compile__/qt-everywhere-opensource-src-${:version}/lib

[qt4.8-qmake]
<= qt4-qmake
[qt4.8.7-qmake]
<= qt4.8-qmake

