---
#description_paragraphs: 3
description: |-
 This a re-port of a perl interface to Tk8.4.
 C code is derived from Tcl/Tk8.4.5.
 It also includes all the C code parts of Tix8.1.4 from SourceForge.
 The perl code corresponding to Tix's Tcl code is not fully implemented.
 
 Perl API is essentially the same as Tk800 series Tk800.025 but has not
 been verified as compliant. There ARE differences see pod/804delta.pod.
#summary: override summary from CPAN
#no_testing: broken upstream
#sources:
#  - source1
#  - source2
patches:
  Tk-804.029-event.diff: -p0
  Tk-804.029-macro.diff: -p0
  Tk-804.029-null.diff: -p0
  Tk-804.029-refcnt.diff: -p0
  Tk-804.036-fix-strlen-vs-int-pointer-confusion.patch: -p0
  Tk-804-config-C99.diff: -p0 PATCH-FIX-UPSTREAM fix gcc14 build error https://github.com/eserte/perl-tk/issues/98
preamble: |-
  BuildRequires:  liberation-fonts
  BuildRequires:  libjpeg-devel
  BuildRequires:  libpng-devel
  BuildRequires:  pkgconfig(x11)
  BuildRequires:  pkgconfig(xft)
  BuildRequires:  pkgconfig(xproto)
  BuildRequires:  pkgconfig(xt)
  BuildRequires:  xkeyboard-config
  %if 0%{?suse_version} >= 01550
  BuildRequires:  xvfb-run
  BuildRequires:  perl(Devel::Leak)
  BuildRequires:  perl(Test::More)
  BuildRequires:  perl(Test::Pod)
  %endif
  BuildRequires:  xorg-x11-Xnest
  BuildRequires:  xorg-x11-Xvfb
  BuildRequires:  xorg-x11-fonts
  BuildRequires:  xorg-x11-fonts-100dpi
  BuildRequires:  xorg-x11-fonts-scalable
  BuildRequires:  perl(Encode)
  BuildRequires:  perl(ExtUtils::MakeMaker)
  BuildRequires:  zlib-devel
  %ifnarch s390 s390x
  BuildRequires:  xorg-x11-server
  %endif
post_prep: |-
  find . -type f -name "Tcl-pTk" -print0 | xargs -0 chmod +x
  find . -type f -name "mkVFunc" -print0 | xargs -0 chmod +x
#post_build: |-
# rm unused.files
#post_install: |-
# sed on %{name}.files
license: (GPL-1.0-or-later OR Artistic-1.0) AND Zlib
#skip_noarch: 1
custom_build: |-
  # Work around boo#1225909, see the bug for more details
  %global optflags %{optflags} -fpermissive

  find -name "*.orig" -exec rm {} \;
  for file in `find -type f` ; do
    grep -q "%{_prefix}/local/bin/perl" $file && \
        sed -i -e "s@%{_prefix}/local/bin/perl@%{_bindir}/perl@g" "$file"
    grep -q "%{_prefix}/local/bin/nperl" $file && \
        sed -i -e "s@%{_prefix}/local/bin/nperl@%{_bindir}/nperl@g" "$file"
    grep -q "#!\s*/bin/perl" $file && \
        sed -i -e "s@/bin/perl@%{_bindir}/perl@g" "$file"
    grep -q "#!\s*/tools/local/perl" $file && \
        sed -i -e "s@/tools/local/perl@%{_bindir}/perl@g" "$file"
    grep -q "%{_prefix}/local/bin/new/perl" $file && \
        sed -i -e "s@%{_prefix}/local/bin/new/perl@%{_bindir}/perl@g" "$file"
  done
  perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" XFT=1
  make %{?_smp_mflags} CFLAGS="%{optflags} -Wall -fpic"
custom_test: |-
  %if 0%{?suse_version} >= 01550
  xvfb-run -a make test  %{?_smp_mflags} V=1
  %else
  Xvfb :95 -screen 0 1280x1024x24 & #430569
  trap "kill $!" EXIT
  sleep 5
  DISPLAY=:95 make test %{?_smp_mflags}
  %endif
#startserver && make test
#ignore_requires: Bizarre::Module
misc: |-
 %exclude %{perl_vendorarch}/Tk/pTk
 %exclude %{perl_vendorarch}/Tk/*.h

 %package devel
 Summary:        Development files for perl-Tk
 Requires:       %{name} = %{version}
 
 %description devel
 Development files for Tk - a graphical user interface toolkit for Perl

 %files devel
 %{perl_vendorarch}/Tk/pTk
 %{perl_vendorarch}/Tk/*.h
skip_doc: add_version build_ptk checklen check_source check_syms cleanup copydate db57 debug debug.bat dupsyms exetype fixfunc gdb.plx gedi generate hackMM keyWords menubug mkExt mkppm.bat myConfig needed perlfiles ptked ptksh r README-ActiveState.txt README.AIX README.cygwin README.darwin README.HPUX README.IRIX README.OpenBSD README.os2 README.OSF README.SCO README.Solaris README-Strawberry.txt README.SVR4 README.ultrix rebuild sm stripblib submethods symbols tcl2perl tkGlue.def tkGlue.exc tkGlue.m tkGlue.t TkXSUB.def uninstall vg vtab.def wal
