# fss-0002
# --disable-linux-user is being used because of link errors when it is enabled (also try: --enable-opengl)

main:
  ./configure --prefix=/ $DOCDIR --enable-sdl --enable-curl --enable-bluez --enable-kvm --enable-nptl --enable-system --enable-guest-base --enable-uuid --enable-attr --enable-io-thread --audio-drv-list=alsa,sdl,oss --audio-card-list=ac97,es1370,sb16,hda,adlib,hda,cs4231a,gus --enable-vhost-net --disable-linux-user --enable-uuid --enable-mixemu --enable-curses --enable-vnc-tls --enable-usb-redir --python=$(type -p python)
  sed -i -e 's|^LIBS+=|&-lm |' Makefile
  sed -i -e 's|^LIBS+=|&-lrt |' *-softmmu/config-target.mak
  #sed -i -e '/^CFLAGS=/d' config-host.mak
  sed -i -e 's|\-fstack-protector-all||g' config-host.mak
  #sed -i -e "s|^QEMU_CFLAGS=|CFLAGS=$qemu_cflags -pthread \n& $qemu_cflags -pthread |g" config-host.mak
  sed -i -e 's|^CFLAGS=|& -pthread |g' config-host.mak
  sed -i -e 's|^LDFLAGS=|& -pthread |' config-host.mak
  make
  make install
  chgrp e_emulate -R /bin/qemu{,-img,-io,-nbd} /etc/qemu /share/qemu
  chmod o-rx -R /bin/qemu{,-img,-io,-nbd} /etc/qemu /share/qemu
  if [[ -f /bin/qemu-ga ]] ; then chgrp e_emulate /bin/qemu-ga ; fi
  if [[ -f /bin/qemu-ga ]] ; then chmod o-rx /bin/qemu-ga ; fi
  for i in arm cris m68k microblaze mips mips64 mips64el mipsel ppc ppc64 ppcemb sh4 sh4eb sparc sparc64 x86_64 lm32 microblazeel s390x ; do if [[ -f /bin/qemu-system-$i ]] ; then chgrp e_emulate /bin/qemu-system-$i ; fi ; done
  for i in arm cris m68k microblaze mips mips64 mips64el mipsel ppc ppc64 ppcemb sh4 sh4eb sparc sparc64 x86_64 lm32 microblazeel s390x ; do if [[ -f /bin/qemu-system-$i ]] ; then chmod o-rx  /bin/qemu-system-$i ; fi ; done

text_mode:
  ./configure --prefix=/ $DOCDIR --enable-curl --enable-bluez --enable-kvm --enable-nptl --enable-system --enable-guest-base --enable-uuid --enable-attr --enable-io-thread --enable-vhost-net --disable-linux-user --enable-uuid --enable-mixemu --enable-curses --enable-vnc-tls --enable-usb-redir --python=$(type -p python)
  sed -i -e 's|^LIBS+=|&-lm |' Makefile
  sed -i -e 's|^LIBS+=|&-lrt |' *-softmmu/config-target.mak
  #sed -i -e '/^CFLAGS=/d' config-host.mak
  sed -i -e 's|\-fstack-protector-all||g' config-host.mak
  #sed -i -e "s|^QEMU_CFLAGS=|CFLAGS=$qemu_cflags -pthread \n& $qemu_cflags -pthread |g" config-host.mak
  sed -i -e 's|^CFLAGS=|& -pthread |g' config-host.mak
  sed -i -e 's|^LDFLAGS=|& -pthread |' config-host.mak
  make
  make install
  if [[ -f /bin/qemu-ga ]] ; then chgrp e_emulate /bin/qemu-ga ; fi
  if [[ -f /bin/qemu-ga ]] ; then chmod o-rx /bin/qemu-ga ; fi
  chgrp e_emulate -R /bin/qemu{,-img,-io,-nbd} /etc/qemu /share/qemu
  chmod o-rx -R /bin/qemu{,-img,-io,-nbd} /etc/qemu /share/qemu
  for i in arm cris m68k microblaze mips mips64 mips64el mipsel ppc ppc64 ppcemb sh4 sh4eb sparc sparc64 x86_64 lm32 microblazeel s390x ; do if [[ -f /bin/qemu-system-$i ]] ; then chgrp e_emulate /bin/qemu-system-$i ; fi ; done
  for i in arm cris m68k microblaze mips mips64 mips64el mipsel ppc ppc64 ppcemb sh4 sh4eb sparc sparc64 x86_64 lm32 microblazeel s390x ; do if [[ -f /bin/qemu-system-$i ]] ; then chmod o-rx  /bin/qemu-system-$i ; fi ; done
