[buildout]
extends =
  ../cmake/buildout.cfg
  ../libjpeg/buildout.cfg
  ../lzo/buildout.cfg
  ../libtirpc/buildout.cfg
  ../kerberos/buildout.cfg
  ../xorg/buildout.cfg

parts =
  x11vnc

[libvncserver]
recipe = slapos.recipe.cmmi
shared = true
url = https://github.com/LibVNC/libvncserver/archive/refs/tags/LibVNCServer-0.9.13.tar.gz
md5sum = 503b5527b93dce77e8b6a45f273f6e39
configure-command = cmake
configure-options =
  -Bbuild
  -DCMAKE_INSTALL_PREFIX=@@LOCATION@@
  -DBUILD_SHARED_LIBS=ON
  -DWITH_SYSTEMD=OFF
  -DWITH_SDL=OFF
  -DWITH_GTK=OFF
  -DWITH_WEBSOCKETS=ON
  -DWITH_LZO=ON
  -DWITH_GCRYPT=ON
  -DWITH_IPv6=ON
  -DWITH_JPEG=ON
  -DWITH_FFMPEG=OFF
  -DWITH_PNG=ON
  -DWITH_GNUTLS=ON
  -DWITH_OPENSSL=ON
  -DZLIB_INCLUDE_DIR=${zlib:location}/include
  -DZLIB_LIBRARY=${zlib:location}/lib/libz.so
  -DJPEG_LIBRARY=${libjpeg-turbo2:location}/lib/libjpeg.so
  -DJPEG_INCLUDE_DIR=${libjpeg-turbo2:location}/include
  -DPNG_LIBRARY=${libpng:location}/lib/libpng.so
  -DPNG_PNG_INCLUDE_DIR=${libpng:location}/include
  -DOPENSSL_INCLUDE_DIR=${openssl:location}/include
  -DLZO_INCLUDE_DIR=${lzo:location}/include
  -DLZO_LIBRARIES=${lzo:location}/lib/liblzo2.a
  -DGNUTLS_LIBRARY=${gnutls:location}/lib/libgnutls.so
  -DGNUTLS_INCLUDE_DIR=${gnutls:location}/include

make-options = -C build
environment =
  PATH=${cmake:location}/bin:${pkgconfig:location}/bin:%(PATH)s
  PKG_CONFIG_PATH=${zlib:location}/lib/pkgconfig:${libpng:location}/lib/pkgconfig:${libjpeg-turbo2:location}/lib/pkgconfig:${openssl:location}/lib/pkgconfig
  CPPFLAGS=-I${openssl:location}/include -I${libgcrypt:location}/include -I${libjpeg-turbo2:location}/include -I${gnutls:location}/include -I${lzo:location}/include
  LDFLAGS=-L${libgcrypt:location}/lib -Wl,-rpath=${libgcrypt:location}/lib -L${openssl:location}/lib -Wl,-rpath=${openssl:location}/lib -L${libjpeg-turbo2:location}/lib -Wl,-rpath=${libjpeg-turbo2:location}/lib -Wl,-rpath=${libpng:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib -L${gnutls:location}/lib -Wl,-rpath=${gnutls:location}/lib -L${lzo:location}/lib -pthread -ljpeg

[x11vnc]
recipe = slapos.recipe.cmmi
url = https://github.com/LibVNC/x11vnc/archive/354602cffa8edcbe813da6dfd051b96d94b3efbc.zip
md5sum = f9a7f5e206aa0120f3337abf0910851d
pre-configure =
  autoreconf -fiv -I ${libtool:location}/share/aclocal -I ${pkgconfig:location}/share/aclocal -I ${gettext:location}/share/aclocal
configure-options =
  --without-crypt
  --without-avahi
  --without-xinerama
  --without-xtrap
  --without-xrecord
  --without-v4l
  --without-fbpm
  --without-dpms
environment =
  PATH=${autoconf:location}/bin:${automake:location}/bin:${libtool:location}/bin:${pkgconfig:location}/bin:%(PATH)s
  PKG_CONFIG_PATH=${openssl:location}/lib/pkgconfig:${libX11:location}/lib/pkgconfig:${xproto:location}/lib/pkgconfig:${libX11:pkg_config_depends}:${libXext:location}/lib/pkgconfig:${xextproto:location}/lib/pkgconfig:${libXtst:location}/lib/pkgconfig:${libvncserver:location}/lib/pkgconfig:${zlib:location}/lib/pkgconfig
  CPPFLAGS=-I${openssl:location}/include -I${libX11:location}/include -I${xproto:location}/include -I${xorgproto:location}/include -I${libXi:location}/include -I${libXtst:location}/include -I${libXext:location}/include -I${xextproto:location}/include -I${libvncserver:location}/include -I${zlib:location}/include -I${libXrandr:location}/include -I${xfixes:location}/include -I${xdamage:location}/include -I${libXcomposite:location}/include -I${libXrender:location}/include
  LDFLAGS=-L${openssl:location}/lib -Wl,-rpath=${openssl:location}/lib -L${libX11:location}/lib -Wl,-rpath=${libX11:location}/lib -L${xproto:location}/lib -L${xorgproto:location}/lib -L${libXi:location}/lib -L${libXtst:location}/lib -Wl,-rpath=${libXtst:location}/lib -L${libXext:location}/lib -L${xextproto:location}/lib -Wl,-rpath=${libXext:location}/lib -L${libvncserver:location}/lib -Wl,-rpath=${libvncserver:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib -L${libXrandr:location}/lib -Wl,-rpath=${libXrandr:location}/lib -L${xfixes:location}/lib -Wl,-rpath=${xfixes:location}/lib -L${xdamage:location}/lib -Wl,-rpath=${xdamage:location}/lib -L${libXcomposite:location}/lib -Wl,-rpath=${libXcomposite:location}/lib -L${libXrender:location}/lib -Wl,-rpath=${libXrender:location}/lib -Wl,-rpath=${libtirpc:location}/lib -Wl,-rpath=${kerberos:location}/lib
