Bug 202606 - app-emulation/kqemu ~x86-fbsd keyword request (w/ patch)
Bug#: 202606 Product:  Gentoo Linux Version: unspecified Platform: x86
OS/Version: FreeBSD Status: NEW Severity: enhancement Priority: P2
Resolution:  Assigned To: bsd@gentoo.org Reported By: f.mensik@tiscali.cz
Component: Ebuilds
URL: 
Summary: app-emulation/kqemu ~x86-fbsd keyword request (w/ patch)
Keywords:  KEYWORDREQ
Status Whiteboard: 
Opened: 2007-12-17 18:47 0000
Description:   Opened: 2007-12-17 18:47 0000
hi,
I've updated kqemu-1.3.0_pre11.ebuild file to be built on Gentoo/FreeBSD x86.
Here are 2 patches:
1.patch is patched kqemu-1.3.0_pre11.ebuild file
2.patch is 'kqemu-1.3.0_pre11-Makefile.patch' file which must be placed into
app-emulation/kqemu/files directory:

--- kqemu-1.3.0_pre11.ebuild    2007-11-19 11:46:42 +0100
+++ kqemu-1.3.0_pre11.ebuild.new        2007-12-15 00:44:05 +0100
@@ -23,13 +23,16 @@

 pkg_setup() {
         MODULE_NAMES="kqemu(misc:${S})"
-        linux-mod_pkg_setup
+        [ "${KERNEL}" = "linux" ] && linux-mod_pkg_setup
 }

 src_unpack() {
         unpack ${A}
         cd ${S}
         epatch ${FILESDIR}/${P}-sched_h.patch
+        if [ "${KERNEL}" = "FreeBSD" ]; then
+                epatch ${FILESDIR}/${P}-Makefile.patch
+        fi
         sed -i 's:MODULE_PARM(\([^,]*\),"i");:module_param(\1, int, 0);:'
kqemu-linux.c
 }

@@ -43,27 +46,42 @@
         ./configure --kernel-path="${KV_DIR}" \
                 || die "could not configure"

-        make
+        if [ "${KERNEL}" = "FreeBSD" ]; then
+                gmake -C common all
+                MAKE=make
+                emake -f Makefile.freebsd
+        else
+                make
+        fi
 }

 src_install() {
-        linux-mod_src_install
-
-        # udev rule
-        dodir /etc/udev/rules.d/
-        echo 'KERNEL=="kqemu*", NAME="%k", GROUP="qemu", MODE="0660"' >
${D}/etc/udev/rules.d/48-qemu.rules
+        if [ "${KERNEL}" = "linux" ]; then
+                linux-mod_src_install
+        else
+                insinto /boot/modules
+                doins "${S}"/kqemu.kld
+                exeinto /boot/modules
+                doexe "${S}"/kqemu.ko
+        fi
+
+        if [ "${KERNEL}" = "linux" ]; then
+                # udev rule
+                dodir /etc/udev/rules.d/
+                echo 'KERNEL=="kqemu*", NAME="%k", GROUP="qemu", MODE="0660"'
> ${D}/etc/udev/rules.d/48-qemu.rules
+
+                # module params
+                dodir /etc/modules.d
+                echo "options kqemu major=0" > ${D}/etc/modules.d/kqemu
+        fi

         # Module doc
         dodoc ${S}/README
         dohtml ${S}/kqemu-doc.html
-
-        # module params
-        dodir /etc/modules.d
-        echo "options kqemu major=0" > ${D}/etc/modules.d/kqemu
 }

 pkg_postinst() {
-        linux-mod_pkg_postinst
+        [ "${KERNEL}" = "linux" ] && linux-mod_pkg_postinst
         enewgroup qemu
         elog "Make sure you have the kernel module loaded before running qemu"
         elog "and your user is in the 'qemu' group"


--- common/Makefile     2007-02-06 22:02:00 +0100
+++ common/Makefile.new 2007-12-15 00:05:00 +0100
@@ -41,7 +41,7 @@
 endif

 DEFINES=-D__KERNEL__
-INCLUDES=-nostdinc -iwithprefix include -I. -I..
+INCLUDES=-nostdinc -iwithprefix include -I. -I.. -I/usr/include
 TOOLS_CFLAGS=-Wall -O2 -Werror -g
 COMMON_CFLAGS=-Wall -O2 -fomit-frame-pointer -fno-strict-aliasing -Werror 
 ifeq ($(ARCH), x86_64)


Reproducible: Always

------- Comment #1 From Jakub Moc (RETIRED) 2007-12-18 09:21:08 0000 -------
Please don't paste patches inline next time, it kills formatting. We have
attachments for this.