# Maintainer: PktSurf <smlinux@pktsurf.in>
app=cmake
version=3.27.7
build=1sml
homepage="http://www.cmake.org"
download="https://github.com/Kitware/CMake/releases/download/v$version/cmake-$version.tar.gz"
desc="Cross-platform, open-source make system"
requires="gcc-libs openssl libunistring libidn2"

prepbuilddir() {
  mkandenterbuilddir
  rm -rf $app-$version

  tar xf $srcdir/$app-$version.tar.?z*
  cd $app-$version
  fixbuilddirpermissions
  applypatch $srcdir/pkgconfig-whitespace.patch
}

build() {
  para="$(echo $MAKEFLAGS | sed 's/-j//')"

  ./bootstrap \
    --prefix= \
    --no-system-curl \
    --no-system-expat \
    --no-system-jsoncpp \
    --no-system-zlib \
    --no-system-bzip2 \
    --no-system-libarchive \
    --no-qt-gui \
    --parallel="$para" \
    --generator=Ninja

  ninja
  DESTDIR=$pkg ninja install

  cp Licenses/* Copyright.txt $pkgdocs/ 

  mkfinalpkg
}

sha512sums="
875b8a67ace104977367d1cb0984307161263c2dd5c36cb4a6af82c2d88fa250a53dd683f234807b28a9b846d2a0dfef225ed02e9feb61960d2999e090118f11  cmake-3.27.7.tar.lz
675c27a8ef1445381fdb20da354621f232964484e9806ba17f67b5840f2e132baf51db3007f8aa580bd68ef48ef76c0a10e155bb68890b3cbb821ffab660cd34  pkgconfig-whitespace.patch
"