bochs.spec 6.0 KB

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