bochs.spec 6.5 KB

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