From 5595bd9f091248a9cc8dcca60776cd7c919d10ef Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sun, 16 Feb 2014 18:06:33 -0600
Subject: oss: 4.2_2008 update binary path to /usr/bin refs #961

---
 abs/extra/oss/PKGBUILD          | 158 +++++++++++++++++++++++-----------------
 abs/extra/oss/kmod-link.patch   |  27 +++++++
 abs/extra/oss/oss.install       |  45 ++----------
 abs/extra/oss/oss.service       |  12 +++
 abs/extra/oss/ossvermagic.patch |  12 +++
 abs/extra/oss/rc-script         |  30 --------
 6 files changed, 151 insertions(+), 133 deletions(-)
 create mode 100644 abs/extra/oss/kmod-link.patch
 create mode 100644 abs/extra/oss/oss.service
 create mode 100644 abs/extra/oss/ossvermagic.patch
 delete mode 100644 abs/extra/oss/rc-script

diff --git a/abs/extra/oss/PKGBUILD b/abs/extra/oss/PKGBUILD
index 8303c40..829c839 100644
--- a/abs/extra/oss/PKGBUILD
+++ b/abs/extra/oss/PKGBUILD
@@ -1,88 +1,114 @@
-# $Id: PKGBUILD 54037 2011-08-12 13:13:29Z bluewind $
-# Maintainer: Florian Pritz <bluewind@xinu.at>
+# Maintainer: Damian Nowak <damian.nowak@atlashost.eu>
+# Maintainer: Julian Rother <julian@toksik.org>
+# Contributor: Sebastian Schwarz <seschwar@gmail.com>
+# Contributor: Kyle Keen <keenerd@gmail.com>
+# Contributor: Florian Pritz <bluewind@xinu.at>
 # Contributor: Paulo Matias <matiasΘarchlinux-br·org>
 # Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
 
+pkgbase=oss
 pkgname=oss
-pkgver=4.2_2006
-pkgrel=1
-pkgdesc="Open Sound System UNIX audio architecture"
-arch=('i686' 'x86_64')
+true && pkgname=(oss libflashsupport-oss)
+pkgver=4.2_2008
+pkgrel=3
+arch=(i686 x86_64)
 url="http://developer.opensound.com/"
-license=('GPL2')
-depends=('gcc' 'make' 'linux-headers' 'module-init-tools' 'libtool' 'sed')
-makedepends=('pkgconfig' 'gawk' 'gtk2' 'findutils')
-optdepends=('gtk2: for graphical mixer (ossxmix)')
-conflicts=('oss-linux' 'oss-linux-free' 'oss-testing' 'libflashsupport' 'libflashsupport-pulse' 'libflashsupport-oss')
-replaces=('libflashsupport-oss')
-install=oss.install
-backup=('usr/lib/oss/soundon.user')
+license=(GPL2)
+makedepends=(gcc gtk2)
 source=("http://www.4front-tech.com/developer/sources/stable/gpl/oss-v${pkgver/_*}-build${pkgver/*_}-src-gpl.tar.bz2"
-	"rm-init-scripts.patch"
-	"rc-script"
-	"soundon.patch"
-	"remove-hal.patch"
-	)
+        'linux-3.8.0.patch::http://www.opensound.com/forum/download/file.php?id=113'
+        'linux-3.10.0.patch::http://www.opensound.com/forum/download/file.php?id=126'
+        'linux-3.10.7.patch::http://www.opensound.com/forum/download/file.php?id=129'
+        oss.service
+        remove-hal.patch
+        rm-init-scripts.patch
+        soundon.patch
+        kmod-link.patch
+        ossvermagic.patch)
+sha512sums=('bb80a5b6943724a668888684e0d8ec2c5799530ed6943a50a0f68b4eea2d639579e0bbaba4a614267bad4792252d0b3a431d926ae7bf15b01df9442988118b07'
+            '6483ed671b79a01dded17732e23a7cb8141329b62a2ddb812567f119389e98afc735d6b3cea20e801517d1a417dc823a3ebdbdcba004f44a0c3e6674a169a16e'
+            'a2793ec82152167615428ed00ba423fa0571bafdb3e5eb790a02a276d5a4eb663c8a4bae6923f7b2536ed8ed5683254bb1efea26336810b7685aa2b1c9f4a5c5'
+            '609367d6eadc29a34535461db719b132fe675a06a0532ea3a451191b21a0499801a3a6e706a214833db8179741086a9c1a3f450b79d2d663ec8fb173c97c01f8'
+            '355e1380432947c0e9caa21114b2c3debeb162fb5abcf845125ec281ce52b437ad1ee1db04d37e9b7a5ac79816c4dcbc21b4ed4cf8191f71218d99acd7bab70e'
+            '6956e5e2e9323b568bb18e80bbee591b0e5ffd3d4612a50df09879941b2733c31d6b3178dc9a46c283bd1629f76b7ff5e2b54893a42a47f6379eaee4731fd9be'
+            '64e6d9d8eb5320f737d3a0698a245da2b2d141b68cfb2f02e448144d1c610aa8b8a6c38b56fcca364d63171a49afe93161a00545cdb90086b5328997b3096690'
+            'a8196aeea43499f4822bad6adc8c7f8721eb122045732ab34bb675182a1c4403c3f4a30ead85188fdaec77ee79a5097dd8de84782f8915db4061157474b5c7c6'
+            'f73b837643c7b86c5ce3a2ff18a66b99166d16ac7d1ac3d419b203efd8d398d8c4b21c304d6fa1c038ebf180ca0620d6517be384b307bb66e84a15b0339800df'
+            'eec0608d82d5bec305b374d9cb62d70860d7be833f87f563a828c44b2dd67754cb27716194d2ea2707391d1257ba1b4b7b5cdf513d618dfd877a065999baa4ad')
+_dir=oss-v${pkgver/_*}-build${pkgver/*_}-src-gpl
 
-build() {
-	_dir=oss-v${pkgver/_*}-build${pkgver/*_}-src-gpl
-	cd "${srcdir}/${_dir}"
+prepare() {
+  cd "$srcdir/$_dir"
 
-	# Avoid these flags conflicting with OSS build system.
-	unset CFLAGS
-	unset LDFLAGS
-	unset OSFLAGS
-	unset LIBRARIES
-	export NO_WARNING_CHECKS=yes
+  # OSS wants an empty build directory
+  rm -rf build
+  mkdir build
 
-	# Compile libflashsupport.so only in packaging time, so we avoid
-	# conflicts with other packages and ease package management.
-	msg "Building libflashsupport.so."
-	cd oss/lib/
-	gcc -shared -fPIC -O2 -Wall -Werror flashsupport.c -o libflashsupport.so
+  # make OSS compile with current Linux kernels
+  patch -p0 < "$srcdir/linux-3.8.0.patch"
+  patch -p0 < "$srcdir/linux-3.10.0.patch"
+  patch -p0 < "$srcdir/linux-3.10.7.patch"
+  patch -p0 < "$srcdir/ossvermagic.patch"
 
-	msg "Preparing the build environment."
-	cd "${srcdir}"
+  # remove outdated stuff
+  cd setup/Linux
+  patch -p2 < "$srcdir/rm-init-scripts.patch"
+  rm oss/etc/S89oss
+  patch -p2 < "$srcdir/remove-hal.patch"
+  rm oss/scripts/*oss_usb-create-device*
+  patch -p1 < "$srcdir/soundon.patch"
 
-	# Create build directory and configure
-	rm -rf build
-	mkdir build && cd build
-	"${srcdir}/${_dir}/configure" --enable-libsalsa=NO --regparm
+  # FS#35672
+  mv oss/build/{osscore.c,osscore_wrapper.c}
+  patch -p2 < "$srcdir/kmod-link.patch"
+  cd ../..
+}
 
-	msg "Building OSS."
-	make build
+build() {
+  cd "$srcdir/$_dir/build"
+  ../configure --enable-libsalsa=NO --regparm
+  make build
+  gcc $CFLAGS -shared -fPIC -Wall -Werror oss/lib/flashsupport.c \
+      -o libflashsupport.so
+}
 
-	msg "Patching init scripts."
-	cd "${srcdir}/build/prototype"
-	rm usr/lib/oss/etc/S89oss
-	patch -p0 -i "${srcdir}/rm-init-scripts.patch"
-	patch -p0 -i "${srcdir}/soundon.patch"
-	# remove hal dependency
-	patch -p0 -i "${srcdir}/remove-hal.patch"
+package_libflashsupport-oss() {
+  pkgdesc="Adobe flash plugin support lib (OSSv4)"
+  conflicts=(libflashsupport libflashsupport-pulse)
+  depends=(oss)
 
-	rm -rf usr/lib/oss/scripts/oss_usb-create-devices usr/lib/oss/scripts/90-oss_usb-create-device.fdi
+  install -dm755 "$pkgdir/usr/lib"
+  ln -s oss/lib/libflashsupport.so "$pkgdir/usr/lib/libflashsupport.so"
 }
 
-package() {
-	_dir=oss-v${pkgver/_*}-build${pkgver/*_}-src-gpl
-	cd "${srcdir}/${_dir}"
+package_oss() {
+  pkgdesc="Open Sound System UNIX audio architecture"
+  depends=(gcc make linux-headers libtool sed)
+  optdepends=('gtk2: for graphical mixer (ossxmix)'
+              'libflashsupport-oss: Adobe flash plugin support')
+  conflicts=(oss-linux oss-linux-free oss-testing)
+  backup=(usr/lib/oss/soundon.user)
+  install=oss.install
 
-	msg "Copying files."
+  cd "$srcdir/$_dir/build"
+  make DESTDIR="$pkgdir/" copy
+  install -Dm755 libflashsupport.so \
+      "$pkgdir/usr/lib/oss/lib/libflashsupport.so"
+  cd "$pkgdir"
 
-	# Install libflashsupport.so
-	install -dm755 "$pkgdir/usr/lib"
-	ln -s oss/lib/libflashsupport.so "$pkgdir/usr/lib/libflashsupport.so"
+  # usr-move fixes
+  mv usr/sbin/* usr/bin
+  rmdir usr/sbin
+  grep -IlrZ '\<s\?bin\>' . \
+      | xargs -0 sed -i 's,\<\(usr/\)\?s\?bin\>,usr/bin,g' --
+  grep -IlrZ '\<lib/modules\>' . \
+      | xargs -0 sed -i 's,\<\(usr/\)\?lib/modules\>,usr/&,g' --
 
-	cd "${srcdir}/build/prototype"
-	cp -a * "${pkgdir}"
+  # make OSS install its modules to /usr/lib/modules/$KERNEL/extramodules/oss
+  grep -IlrZ '\<usr/lib/modules/[^/]\+/kernel/oss\>' . \
+      | xargs -0 sed -i 's,\<usr/lib/modules/\([^/]\+\)/kernel/oss\>,usr/lib/modules/\1/extramodules/oss,g' --
 
-	chmod -R a+r "${pkgdir}" # All files can have read permission (FS#13815)
-	find "${pkgdir}" -type d -exec chmod a+x '{}' \; # Make namcap happy
-	install -Dm755 "${srcdir}/rc-script" "${pkgdir}/etc/rc.d/oss"
+  chmod -R a+rX .  # FS#13815
+  install -Dm644 "$srcdir/oss.service" usr/lib/systemd/system/oss.service
 }
 
-md5sums=('ca25c06bb7d0c6495e1b6f55d1bad96c'
-         'b9a380a0ac8896390d71ac13676f27e1'
-         'cbcbce5c03b127df5eafa8faa091492c'
-         '65f07fe241bfbf912f76d8b6d8f276b5'
-         'cd7f1dc6166bba8c94d96f3a28e948a5')
diff --git a/abs/extra/oss/kmod-link.patch b/abs/extra/oss/kmod-link.patch
new file mode 100644
index 0000000..8ee9ab5
--- /dev/null
+++ b/abs/extra/oss/kmod-link.patch
@@ -0,0 +1,27 @@
+--- setup/Linux/oss/build/install.sh	2012-05-22 00:23:41.000000000 +0200
++++ setup/Linux/oss/build/install.sh	2013-11-10 21:00:08.858276861 +0100
+@@ -203,11 +203,8 @@
+ 	exit 3
+ fi
+ 
+-if ! $LD -r osscore.ko osscore_mainline.o -o /lib/modules/$UNAME/kernel/oss/osscore.ko
+-then
+-	echo Linking the osscore module failed
+-	exit 5
+-fi
++
++cp -f osscore.ko /lib/modules/$UNAME/kernel/oss/osscore.ko
+ 
+ if test -f Module.symvers
+ then
+--- setup/Linux/oss/build/Makefile.osscore	2012-05-22 00:23:41.000000000 +0200
++++ setup/Linux/oss/build/Makefile.osscore	2013-11-14 18:57:44.270163268 +0100
+@@ -5,6 +5,7 @@
+ ifneq ($(KERNELRELEASE),)
+ 
+ 	obj-m := osscore.o
++	osscore-y := osscore_wrapper.o osscore_mainline.o
+ 
+ else
+ 
+
diff --git a/abs/extra/oss/oss.install b/abs/extra/oss/oss.install
index f665416..672d636 100644
--- a/abs/extra/oss/oss.install
+++ b/abs/extra/oss/oss.install
@@ -1,59 +1,30 @@
-_MSG_LIBOSSDIR=" Please note that OSS stores some of its configuration files
- at /usr/lib/oss. If you are upgrading from an older OSS
- release and it doesn't work properly, try removing that
- directory and reinstall this package."
-
 post_install() {
 	echo "Running OSS install script..."
-	/bin/sh /usr/lib/oss/build/install.sh &> /dev/null
-	echo
-	echo "-------------------------------------------------------------"
-	echo " Open Sound System was installed. Now you should add 'oss'"
-	echo " to your DAEMONS variable at /etc/rc.conf, and start the"
-	echo " daemon by running /etc/rc.d/oss start."
+	sh /usr/lib/oss/build/install.sh &>/dev/null
 	echo
 	echo " Note that OSS can't currently work together with kernel"
 	echo " ALSA modules, so they were moved out by the OSS install"
 	echo " scripts. If you want the ALSA kernel modules back, you can"
 	echo " just remove this package using pacman."
-	echo
-	echo "${_MSG_LIBOSSDIR}"
-	echo "-------------------------------------------------------------"
-	/bin/true
 }
 
 post_upgrade() {
 	echo "Running OSS update script..."
-	/bin/sh /usr/lib/oss/build/install.sh &> /dev/null
-	echo
-	echo "-------------------------------------------------------------"
-	echo " Open Sound System was updated. Now you should restart the"
-	echo " daemon by running /etc/rc.d/oss restart."
-	echo
-	echo "${_MSG_LIBOSSDIR}"
-	echo "-------------------------------------------------------------"
-	/bin/true
+	sh /usr/lib/oss/build/install.sh &>/dev/null
+
+	if [[ $(vercmp $2 4.2_2006) == "-1" ]]; then
+		echo "libflashsupport.so has been split into a seperate package."
+		echo "If you want flash to use oss, please install libflashsupport-oss"
+	fi
 }
 
 pre_remove() {
 	# Restore any replaced ALSA drivers.
-	/bin/sh /usr/lib/oss/scripts/restore_drv.sh
-	# Remove symlinks left by the 'install.sh' script.
-	rm -f /usr/lib/hal/scripts/oss_usb-create-devices
-	rm -f /usr/share/hal/fdi/policy/20thirdparty/90-oss_usb-create-device.fdi
-	/bin/true
+	sh /usr/lib/oss/scripts/restore_drv.sh
 }
 
 post_remove() {
-	echo
-	echo "-------------------------------------------------------------"
 	echo " Open Sound System was now removed, and the ALSA kernel"
 	echo " modules were restored."
-	echo
-	echo " Please note that OSS stores some of its configuration files"
-	echo " at /usr/lib/oss. If you don't plan to use OSS anymore, you"
-	echo " can remove this directory."
-	echo "-------------------------------------------------------------"
-	/bin/true
 }
 
diff --git a/abs/extra/oss/oss.service b/abs/extra/oss/oss.service
new file mode 100644
index 0000000..0200d24
--- /dev/null
+++ b/abs/extra/oss/oss.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Open Sound System v4
+Before=sound.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/bin/soundon
+ExecStop=/usr/bin/soundoff
+
+[Install]
+WantedBy=multi-user.target
diff --git a/abs/extra/oss/ossvermagic.patch b/abs/extra/oss/ossvermagic.patch
new file mode 100644
index 0000000..9c20912
--- /dev/null
+++ b/abs/extra/oss/ossvermagic.patch
@@ -0,0 +1,12 @@
+--- os_cmd/Linux/ossvermagic/ossvermagic.c	2013-06-14 06:55:00.000000000 +0200
++++ os_cmd/Linux/ossvermagic/ossvermagic.c	2013-11-14 18:42:23.910206071 +0100
+@@ -81,6 +81,8 @@
+   if (!ok)
+     ok = ELF_LOAD_SYMTAB (fname, "__mod_vermagic", sym_callback);
+   if (!ok)
++    ok = ELF_LOAD_SYMTAB (fname, "__UNIQUE_ID_vermagic0", sym_callback);
++  if (!ok)
+     ELF_LOAD_SYMTAB (fname, "__oss_compile_vermagic", sym_callback);
+ }
+ 
+
diff --git a/abs/extra/oss/rc-script b/abs/extra/oss/rc-script
deleted file mode 100644
index 5c93010..0000000
--- a/abs/extra/oss/rc-script
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-. /etc/rc.conf
-. /etc/rc.d/functions
-
-case "$1" in
-	start)
-		stat_busy 'Starting Open Sound System'
-		if /usr/sbin/soundon; then
-			add_daemon oss
-			stat_done
-		else
-			stat_fail
-		fi
-		;;
-	stop)
-		stat_busy 'Stopping Open Sound System'
-		if /usr/sbin/soundoff; then
-			rm_daemon oss
-			stat_done
-		else
-			stat_fail
-		fi
-		;;
-	restart)
-		$0 stop
-		$0 start
-		;;
-	*)
-		echo "Usage: $0 {start|stop|restart}"
-esac
-- 
cgit v0.12

