Guest User

Untitled

a guest
May 24th, 2012
71
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Summary: Bumblebee daemon
  2. Name: bumblebee
  3. Version: 3.0.0
  4. Release: 1%{?dist}
  5. License: GNU GPLv3
  6. Group: System Environment/Base
  7. Source0: Bumblebee.tar.bz2
  8. # To re-create the source tarball, run the following command:
  9. # git clone git://github.com/Bumblebee-Project/Bumblebee.git
  10. # Then tar/bzip the resulting directory up creating Bumblebee.tar.bz2.
  11. BuildRoot: %{_tmppath}/%{name}-root
  12. BuildRequires: libbsd-devel
  13. Requires: VirtualGL
  14.  
  15. %description
  16. Bumblebee daemon is a rewrite of the original Bumblebee
  17. (https://github.com/Bumblebee-Project/Bumblebee-old)
  18. service, providing an elegant and stable means of managing Optimus
  19. hybrid graphics chipsets. A primary goal of this project is to not only
  20. enable use of the discrete GPU for rendering, but also to enable
  21. smart power management of the dGPU when it's not in use.
  22.  
  23. See: https://github.com/Bumblebee-Project/Bumblebee
  24. http://bumblebee-project.org/
  25.  
  26. For further information.
  27.  
  28. %prep
  29.  
  30. %setup -n Bumblebee
  31.  
  32. %build
  33.  
  34. %if 0%{?fedora} >=15
  35. autoreconf -fi
  36. %else
  37. # Hack needed for compatability with older autoconf included with RHEL 6 and older fedoras.
  38. # fedora 14 came with version 2.66, fedora 13 had 2.65 and RHEL 6 has version 2.63.
  39. # Bumping the requirements down for older fedoras may or may not work and has not been tested.
  40. mv $RPM_BUILD_DIR/Bumblebee/configure.ac $RPM_BUILD_DIR/Bumblebee/configure-fix.ac
  41. sed -e "s|2.68|2.63|g" $RPM_BUILD_DIR/Bumblebee/configure-fix.ac > $RPM_BUILD_DIR/Bumblebee/configure.ac
  42. autoreconf -fi
  43.  
  44.  
  45. %{__cat} <<EOF >bumblebeed.svinit
  46. #!/bin/sh
  47. #
  48. # $Id: bumblebeed,v 1.0 2012/05/06 gsgatlin
  49. # Startup script for the bumblebeed daemon, RedHat style.
  50. #
  51. # chkconfig: - 50 10
  52. # description: Bumblebee supporting nVidia Optimus cards
  53.  
  54. . /etc/init.d/functions
  55.  
  56.  
  57. NAME=bumblebeed
  58. BIN='/usr/sbin/bumblebeed'
  59.  
  60.  
  61.  
  62. [ -x "\$BIN" ] || exit 1
  63.  
  64. RETVAL=0
  65.  
  66. start(){
  67. echo -n \$"Starting bumblebeed daemon: "
  68. daemon "\$BIN" --daemon
  69. RETVAL=\$?
  70. echo
  71. touch /var/lock/subsys/bumblebeed
  72. return \$RETVAL
  73. }
  74.  
  75. stop(){
  76. echo -n \$"Stopping bumblebeed daemon: "
  77. killproc "\$NAME"
  78. echo
  79. RETVAL=\$?
  80. rm -f /var/lock/subsys/bumblebeed
  81. return \$RETVAL
  82. }
  83.  
  84. restart(){
  85. stop
  86. start
  87. }
  88.  
  89. case "\$1" in
  90. start)
  91. start
  92. ;;
  93. stop)
  94. stop
  95. ;;
  96. restart)
  97. restart
  98. ;;
  99. status)
  100. status bumblebeed
  101. ;;
  102. condrestart)
  103. [ -e /var/lock/subsys/bumblebeed ] && restart
  104. ;;
  105. *)
  106. echo \$"Usage: \$0 {start|stop|status|restart|condrestart}"
  107. RETVAL=1
  108. esac
  109.  
  110. exit \$RETVAL
  111. EOF
  112. %endif
  113.  
  114. %configure
  115.  
  116. # On older 32 bit machines only we must remove the "-fstack-protector" CFLAGS because
  117. # the daemon crashes after a single use. See:
  118. # https://github.com/Bumblebee-Project/Bumblebee/issues/153
  119. # and
  120. # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33721
  121. # For further information.
  122.  
  123. %ifarch i686
  124. %if 0%{?fedora} >=15
  125. make %{?_smp_mflags}
  126. %else
  127. make %{?_smp_mflags} CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables"
  128. %endif
  129. %else
  130. make %{?_smp_mflags}
  131. %endif
  132.  
  133.  
  134. %install
  135. [ "$RPM_BUILD_ROOT" != "/" ] && rm -fr $RPM_BUILD_ROOT
  136. make DESTDIR=$RPM_BUILD_ROOT install
  137.  
  138. # systemd is a replacement for SysVinit beginning with fedora 15.
  139. # Fedora 15 does not like symlinks in /etc/systemd/system/ with "enable" for some reason.
  140. %if 0%{?fedora} >=15
  141. mkdir -p $RPM_BUILD_ROOT/%{_unitdir}/
  142. mkdir -p $RPM_BUILD_ROOT/etc/systemd/system/
  143. install -m 644 $RPM_BUILD_DIR/Bumblebee/scripts/systemd/bumblebeed.service $RPM_BUILD_ROOT/%{_unitdir}/
  144. install -m 644 $RPM_BUILD_DIR/Bumblebee/scripts/systemd/bumblebeed.service $RPM_BUILD_ROOT/etc/systemd/system/bumblebeed.service
  145. #ln -s %{_unitdir}/bumblebeed.service $RPM_BUILD_ROOT/etc/systemd/system/bumblebeed.service
  146. %else
  147. mkdir -p $RPM_BUILD_ROOT/etc/init.d/
  148.  
  149. # We must make our own init script which is more compatible with Red Hat type
  150. # systems like RHEL 6 or CentOS 6, etc. This is also required for older fedoras like 14 and lower.
  151. #install -m 755 $RPM_BUILD_DIR/Bumblebee/scripts/sysvinit/bumblebeed $RPM_BUILD_ROOT/etc/init.d/bumblebeed
  152.  
  153. install -m 755 $RPM_BUILD_DIR/Bumblebee/bumblebeed.svinit $RPM_BUILD_ROOT/etc/init.d/bumblebeed
  154.  
  155. %endif
  156. cp $RPM_BUILD_DIR/Bumblebee/conf/bumblebee.conf $RPM_BUILD_ROOT/etc/bumblebee/bumblebee-nouveau.conf
  157.  
  158.  
  159. %clean
  160. [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
  161.  
  162.  
  163. %post
  164. if [ $1 = 1 ]; then
  165. # Initial installation
  166. %if 0%{?fedora} >= 15
  167. /bin/systemctl daemon-reload >/dev/null 2>&1 || :
  168. /bin/systemctl enable bumblebeed.service >/dev/null 2>&1 || :
  169. /bin/systemctl start bumblebeed.service >/dev/null 2>&1 || :
  170. %else
  171. /sbin/chkconfig --add bumblebeed >/dev/null 2>&1 || :
  172. /sbin/chkconfig --level 2345 bumblebeed on >/dev/null 2>&1 || :
  173. /sbin/service bumblebeed start >/dev/null 2>&1 || :
  174. %endif
  175. /usr/sbin/groupadd bumblebee >/dev/null 2>&1 || :
  176. for user in `cat /etc/passwd | grep /home | cut -d: -f1`; do
  177. /usr/sbin/usermod -a -G bumblebee $user >/dev/null 2>&1 || :
  178. done
  179. # Lets use a symlink but only if there is not one there already...
  180. if [ ! -h /etc/bumblebee/bumblebee.conf ]; then
  181. ln -sf /etc/bumblebee/bumblebee-nouveau.conf /etc/bumblebee/bumblebee.conf >/dev/null 2>&1 || :
  182. fi
  183.  
  184. fi
  185. #always
  186. %if 0%{?fedora} >= 15
  187. /bin/systemctl try-restart bumblebeed.service >/dev/null 2>&1 || :
  188. %else
  189. /sbin/service bumblebeed restart >/dev/null 2>&1 || :
  190. %endif
  191.  
  192. %preun
  193. if [ $1 = 0 ]; then
  194. # Package removal, not upgrade
  195. %if 0%{?fedora} >= 15
  196. /bin/systemctl --no-reload disable bumblebeed.service >/dev/null 2>&1 || :
  197. /bin/systemctl stop bumblebeed.service >/dev/null 2>&1 || :
  198. %else
  199. /sbin/service bumblebeed stop >/dev/null 2>&1 || :
  200. /sbin/chkconfig --level 2345 bumblebeed off >/dev/null 2>&1 || :
  201. /sbin/chkconfig --del bumblebeed >/dev/null 2>&1 || :
  202. %endif
  203. \rm -rf /etc/bumblebee/bumblebee.conf >/dev/null 2>&1 || :
  204. fi
  205.  
  206. %postun
  207. %if 0%{?fedora} >= 15
  208. /bin/systemctl daemon-reload >/dev/null 2>&1 || :
  209. if [ $1 -ge 1 ]; then
  210. # Package upgrade, not uninstall
  211. /bin/systemctl try-restart bumblebeed.service >/dev/null 2>&1 || :
  212. fi
  213. %endif
  214.  
  215. %files
  216. %defattr(-,root,root,-)
  217. %doc /usr/share/doc/bumblebee/README.markdown
  218. %doc /usr/share/doc/bumblebee/RELEASE_NOTES_3_0
  219. %exclude /etc/bumblebee/bumblebee.conf
  220. %config(noreplace) /etc/bumblebee/bumblebee-nouveau.conf
  221. /etc/bash_completion.d/bumblebee
  222. /etc/bumblebee/xorg.conf.nouveau
  223. /etc/bumblebee/xorg.conf.nvidia
  224. /usr/bin/bumblebee-bugreport
  225. /usr/bin/optirun
  226. /usr/sbin/bumblebeed
  227. %if 0%{?fedora} >=15
  228. %{_unitdir}/bumblebeed.service
  229. /etc/systemd/system/bumblebeed.service
  230. %else
  231. /etc/init.d/bumblebeed
  232. %endif
  233.  
  234. %changelog
  235. * Wed May 16 2012 Gary Gatling <gsgatlin@ncsu.edu> - 3.0.0-1
  236. - Initial build of a bumblebee rpm suitable for a fedora/RHEL
  237. or RHEL/clone.
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×