newt.spec 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. ##
  2. ## newt.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2006 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2006 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # package version
  25. %define V_major 0.52.2
  26. %define V_minor 2
  27. # package information
  28. Name: newt
  29. Summary: S-Lang based Text Terminal Widget Toolkit
  30. URL: ftp://download.fedora.redhat.com/pub/fedora/linux/core/development/SRPMS/
  31. Vendor: Eric Troan
  32. Packager: OpenPKG
  33. Distribution: OpenPKG
  34. Class: PLUS
  35. Group: Terminal
  36. License: LGPL
  37. Version: %{V_major}.%{V_minor}
  38. Release: 20060118
  39. # list of sources
  40. Source0: ftp://download.fedora.redhat.com/pub/fedora/linux/core/development/SRPMS/newt-%{V_major}-%{V_minor}.src.rpm
  41. Source1: newt.pc
  42. Patch0: newt.patch
  43. # build information
  44. Prefix: %{l_prefix}
  45. BuildRoot: %{l_buildroot}
  46. BuildPreReq: OpenPKG, openpkg >= 20050615, gcc
  47. PreReq: OpenPKG, openpkg >= 20050615
  48. BuildPreReq: slang, gettext, libiconv, popt
  49. PreReq: slang, gettext, libiconv, popt
  50. AutoReq: no
  51. AutoReqProv: no
  52. %description
  53. Newt is a S-Lang based text terminal Widget toolkit. It was
  54. originally designed for use in the installer program for Red Hat
  55. Linux. Newt is not event driven but easy to use. Windows must be
  56. created and destroyed as a stack (in other words, all Newt windows
  57. behave as modal dialogs).
  58. %track
  59. prog newt = {
  60. version = %{V_major}-%{V_minor}
  61. url = ftp://download.fedora.redhat.com/pub/fedora/linux/core/development/SRPMS/
  62. regex = newt-(__VER__)\.src\.rpm
  63. }
  64. %prep
  65. # unpack and patch distribution
  66. %setup -q -c -T
  67. %{l_rpm2cpio} %{SOURCE0} | cpio -idvmu
  68. %{l_gzip} -d -c newt-%{V_major}.tar.gz | %{l_tar} xf -
  69. %patch -p0 -d newt-%{V_major}
  70. chmod u+r newt-%{V_major}/*.orig
  71. %build
  72. # determine available terminal library
  73. # kludge: determine whether vendor termcap, termlib or curses library exists
  74. # reason: some brain-dead platforms (like SuSE, etc) have no termcap library installed.
  75. termlib=""
  76. echo "int main(int argc, char *argv[]) { return 0; }" >dummy.c
  77. for lib in termcap termlib curses ncurses; do
  78. rc=0; %{l_cc} -o dummy dummy.c -l$lib >/dev/null 2>&1 || rc=1
  79. if [ $rc -eq 0 ]; then termlib="-l$lib"; break; fi
  80. done
  81. [ ".$termlib" = . ] && exit 1
  82. %{l_shtool} install -c \
  83. -e 's;@version@;%{version};g' \
  84. -e "s;@libs@;-lslang $termlib;g" \
  85. %{SOURCE newt.pc} .
  86. # build package
  87. ( cd newt-%{V_major}
  88. CC="%{l_cc}" \
  89. CFLAGS="%{l_cflags -O}" \
  90. CPPFLAGS="%{l_cppflags}" \
  91. LDFLAGS="%{l_ldflags}" \
  92. LIBS="$termlib" \
  93. ./configure \
  94. --prefix=%{l_prefix}
  95. %{l_make} %{l_mflags -O}
  96. ) || exit $?
  97. %install
  98. # install package
  99. rm -rf $RPM_BUILD_ROOT
  100. ( cd newt-%{V_major}
  101. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  102. ) || exit $?
  103. # install tutorial as manual page
  104. %{l_shtool} mkdir -f -p -m 755 \
  105. $RPM_BUILD_ROOT%{l_prefix}/man/cat3
  106. %{l_shtool} install -c -m 644 \
  107. newt-%{V_major}/tutorial.txt \
  108. $RPM_BUILD_ROOT%{l_prefix}/man/cat3/newt.3
  109. # install pkgconfig(1) file
  110. %{l_shtool} mkdir -f -p -m 755 \
  111. $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig
  112. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  113. newt.pc $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/
  114. # determine installation files
  115. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  116. %{l_files_std} \
  117. '%not %dir %{l_prefix}/lib/pkgconfig'
  118. %files -f files
  119. %clean
  120. rm -rf $RPM_BUILD_ROOT