bochs.spec 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. ##
  2. ## bochs.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.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 information
  26. Name: bochs
  27. Summary: IA-32 Emulator
  28. URL: http://bochs.sourceforge.net/
  29. Vendor: John Doe
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG [EVAL]
  32. Group: Misc
  33. License: LGPL
  34. Version: 2.0.1
  35. Release: 20030105
  36. # list of sources
  37. Source0: http://osdn.dl.sourceforge.net/sourceforge/bochs/bochs-%{version}.tar.gz
  38. Source1: http://osdn.dl.sourceforge.net/sourceforge/bochs/fdos-10meg.tar.gz
  39. # build information
  40. Prefix: %{l_prefix}
  41. BuildRoot: %{l_buildroot}
  42. BuildPreReq: OpenPKG, openpkg >= 20021218, X11, gcc
  43. PreReq: OpenPKG, openpkg >= 20021218, X11
  44. AutoReq: no
  45. AutoReqProv: no
  46. %description
  47. Bochs is a highly portable open source IA-32 (x86) PC emulator
  48. written in C++, that runs on most popular platforms. It includes
  49. emulation of the Intel x86 CPU, common I/O devices, and a custom
  50. BIOS. Currently, Bochs can be compiled to emulate a 386, 486 or
  51. Pentium CPU. Bochs is capable of running most Operating Systems
  52. inside the emulation including Linux, Windows, DOS, etc.
  53. This package also contains a pre-configured FreeBSD 8h1 image
  54. for Bochs demonstration purposes and to see Bochs running easily.
  55. %prep
  56. %setup0 -q
  57. %setup1 -q -T -D -a 1
  58. # remove CVS sub-directories because they would be
  59. # picked up by "make install" later.
  60. find . -type d -name CVS -print | xargs rm -rf
  61. %build
  62. # make sure Bochs find the global configuration
  63. %{l_shtool} subst \
  64. -e 's;/etc/bochsrc;%{l_prefix}/etc/bochs/bochsrc;' \
  65. main.cc
  66. # configure the sources
  67. CC="%{l_cc}" \
  68. CXX="%{l_cxx}" \
  69. CFLAGS="%{l_cflags -O}" \
  70. CXXFLAGS="%{l_cxxflags -O}" \
  71. ./configure \
  72. --prefix=%{l_prefix} \
  73. --with-x11 \
  74. --x-includes=`%{l_prefix}/etc/rc --query x11_incdir` \
  75. --x-libraries=`%{l_prefix}/etc/rc --query x11_libdir` \
  76. --enable-cpu-level=5 \
  77. --enable-all-optimizations \
  78. --enable-cdrom \
  79. --enable-ne2000 \
  80. --disable-shared
  81. # build the sources
  82. %{l_make} %{l_mflags -O}
  83. %install
  84. rm -rf $RPM_BUILD_ROOT
  85. # pre-generate extra directories
  86. %{l_shtool} mkdir -f -p -m 755 \
  87. $RPM_BUILD_ROOT%{l_prefix}/etc/bochs \
  88. $RPM_BUILD_ROOT%{l_prefix}/libexec/bochs
  89. # perform standard installation procedure
  90. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  91. # post-adjust manual pages
  92. rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/bochs-dlx.1.gz
  93. %{l_gzip} -d $RPM_BUILD_ROOT%{l_prefix}/man/man*/*.gz
  94. # provide configuration file
  95. mv $RPM_BUILD_ROOT%{l_prefix}/share/doc/bochs/bochsrc-sample.txt \
  96. $RPM_BUILD_ROOT%{l_prefix}/etc/bochs/bochsrc.sample
  97. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc
  98. # provide VGA font directory
  99. ( cd $RPM_BUILD_ROOT%{l_prefix}/share/bochs
  100. rm -f install-x11-fonts test-x11-fonts
  101. mkdir fonts; mv vga.pcf fonts/
  102. x11_bindir=`%{l_prefix}/etc/rc --query x11_bindir`
  103. $x11_bindir/mkfontdir fonts
  104. )
  105. # provide executable wrapper which finds the VGA font
  106. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  107. mv $RPM_BUILD_ROOT%{l_prefix}/bin/bochs \
  108. $RPM_BUILD_ROOT%{l_prefix}/libexec/bochs/
  109. ( echo "#!/bin/sh"
  110. echo "xset fp+ %{l_prefix}/share/bochs/fonts"
  111. echo "exec %{l_prefix}/libexec/bochs/bochs \${1+\"\$@\"}"
  112. ) >$RPM_BUILD_ROOT%{l_prefix}/bin/bochs
  113. chmod a+x $RPM_BUILD_ROOT%{l_prefix}/bin/bochs
  114. # install FreeDOS image as default scratch OS
  115. %{l_shtool} mkdir -f -p -m 755 \
  116. $RPM_BUILD_ROOT%{l_prefix}/share/bochs/img
  117. %{l_shtool} install -c -m 644 \
  118. fdos-10meg/fdosmini.img \
  119. $RPM_BUILD_ROOT%{l_prefix}/share/bochs/img/freedos.img
  120. %{l_shtool} install -c -m 644 \
  121. -e 's;$BXBIOS;%{l_prefix}/share/bochs;g' \
  122. -e 's;fdosmini.img;%{l_prefix}/share/bochs/img/freedos.img;g' \
  123. -e '/vga_update_interval.*/d' \
  124. -e '/realtime_pit/d' \
  125. fdos-10meg/bochsrc.txt \
  126. $RPM_BUILD_ROOT%{l_prefix}/etc/bochs/bochsrc
  127. # determine installation files
  128. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  129. %files -f files
  130. %clean
  131. rm -rf $RPM_BUILD_ROOT
  132. %post
  133. if [ $1 -eq 1 ]; then
  134. ( echo "Hint: This Bochs package has a FreeDOS image pre-installed"
  135. echo "In order to run it as a regular user, you either have to"
  136. echo "change the permissions and/or the ownership of the image file"
  137. echo "%{l_prefix}/share/bochs/img/freedos.img manually."
  138. ) | %{l_rpmtool} msg -b -t notice
  139. fi