newt.spec 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. ##
  2. ## newt.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2003 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 [EVAL]
  35. Group: Terminal
  36. License: LGPL
  37. Version: %{V_major}.%{V_minor}
  38. Release: 20031214
  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 >= 20030103, slang, popt
  47. PreReq: OpenPKG, openpkg >= 20030103, slang
  48. AutoReq: no
  49. AutoReqProv: no
  50. %description
  51. Newt is a S-Lang based text terminal Widget toolkit. It was
  52. originally designed for use in the installer program for Red Hat
  53. Linux. Newt is not event driven but easy to use. Windows must be
  54. created and destroyed as a stack (in other words, all Newt windows
  55. behave as modal dialogs).
  56. %prep
  57. # unpack and patch distribution
  58. %setup -q -c -T
  59. %{l_prefix}/bin/rpm2cpio %{SOURCE0} | cpio -idvmu
  60. %{l_gzip} -d -c newt-%{V_major}.tar.gz | %{l_tar} xf -
  61. ( cd newt-%{V_major}
  62. %patch -p0
  63. chmod u+r *.orig
  64. ) || exit $?
  65. %build
  66. # determine available terminal library
  67. # kludge: determine whether vendor termcap, termlib or curses library exists
  68. # reason: some brain-dead platforms (like SuSE, etc) have no termcap library installed.
  69. termlib=""
  70. echo "int main(int argc, char *argv[]) { return 0; }" >dummy.c
  71. for lib in termcap termlib curses ncurses; do
  72. rc=0; %{l_cc} -o dummy dummy.c -l$lib >/dev/null 2>&1 || rc=1
  73. if [ $rc -eq 0 ]; then termlib="-l$lib"; break; fi
  74. done
  75. [ ".$termlib" = . ] && exit 1
  76. %{l_shtool} install -c \
  77. -e 's;@version@;%{version};g' \
  78. -e "s;@libs@;-lslang $termlib;g" \
  79. %{SOURCE newt.pc} .
  80. # build package
  81. ( cd newt-%{V_major}
  82. CC="%{l_cc}" \
  83. CFLAGS="%{l_cflags -O}" \
  84. CPPFLAGS="%{l_cppflags}" \
  85. LDFLAGS="%{l_ldflags}" \
  86. LIBS="$termlib" \
  87. ./configure \
  88. --prefix=%{l_prefix}
  89. %{l_make} %{l_mflags -O}
  90. ) || exit $?
  91. %install
  92. # install package
  93. rm -rf $RPM_BUILD_ROOT
  94. ( cd newt-%{V_major}
  95. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  96. ) || exit $?
  97. # install tutorial as manual page
  98. %{l_shtool} mkdir -f -p -m 755 \
  99. $RPM_BUILD_ROOT%{l_prefix}/man/cat3
  100. %{l_shtool} install -c -m 644 \
  101. newt-%{V_major}/tutorial.txt \
  102. $RPM_BUILD_ROOT%{l_prefix}/man/cat3/newt.3
  103. # install pkgconfig(1) file
  104. %{l_shtool} mkdir -f -p -m 755 \
  105. $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig
  106. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  107. newt.pc $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/
  108. # determine installation files
  109. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  110. %{l_files_std} \
  111. '%not %dir %{l_prefix}/lib/pkgconfig'
  112. %files -f files
  113. %clean
  114. rm -rf $RPM_BUILD_ROOT