makedepends=(cairo icu xorg-pixman xorg-libxaw)

description="Library for synchronization between TeX files and resulting file"
url="https://tug.org/texlive/"

maintainer="Great-OS Team"
packager="Great-OS Team"

name=libsynctex
version=2025.2
_version=svn74917
release=1

source=(https://github.com/TeX-Live/texlive-source/archive/refs/tags/svn74917.tar.gz)

build() {

  cd texlive-source-${_version}

  mkdir ../build && cd ../build

  CFLAGS+=" -fcommon"
  CFLAGS=${CFLAGS/FORTIFY_SOURCE=3/FORTIFY_SOURCE=2}
  CFLAGS+=" -Wno-incompatible-pointer-types -std=gnu17" \
    ax_cv_c_float_words_bigendian=no \

  ../texlive-source-${_version}/configure \
               --prefix=/usr \
               --mandir=/usr/share/man \
               --infodir=/usr/share/info \
               --with-system-zlib \
               --with-system-pixman \
               --with-system-cairo \
               --with-system-icu \
               --with-system-gmp \
               --with-system-mpfr \
               --disable-native-texlive-build \
               --disable-static \
               --enable-shared \
               --disable-dvisvgm

  make
  make -C texk/web2c

  make -C texk/web2c DESTDIR=$PKG \
  install-data-am install-libLTLIBRARIES
}
