newt.spec 4.6 KB

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