bochs.spec 6.0 KB

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