opensound: fixes for x86_64

* fix build for x86_64
* fix source url
* fixes for SMAP
This commit is contained in:
Gerasim Troeglazov
2019-01-27 23:32:43 +10:00
parent b61c1f31d7
commit 635ae302da
3 changed files with 143 additions and 157 deletions

View File

@@ -5,34 +5,16 @@ provide a uniform API across all the major UNIX architectures."
HOMEPAGE="http://developer.opensound.com/"
COPYRIGHT="1996-2017 Hannu Savolainen and Dev Mazumdar"
LICENSE="BSD (2-clause)"
REVISION="2"
SOURCE_URI="http://www.4front-tech.com/developer/sources/stable/bsd/oss-v4.2-build2017-src-bsd.tar.bz2"
REVISION="3"
SOURCE_URI="http://www.4front-tech.com/developer/sources/stable/bsd/oss-v$portVersion-build2017-src-bsd.tar.bz2"
CHECKSUM_SHA256="8ef2b1b964719b4c356de234d4b28832302027dc23bf636820be1afe1b099972"
SOURCE_DIR="oss-v4.2-build2017-src-bsd"
PATCHES="opensound-4.2_git.patchset"
SOURCE_DIR="oss-v$portVersion-build2017-src-bsd"
PATCHES="opensound-$portVersion.patchset"
ARCHITECTURES="x86_gcc2 ?x86"
ARCHITECTURES="x86_gcc2 x86_64"
GLOBAL_WRITABLE_FILES="
settings/kernel/drivers/oss_audigyls keep-old
settings/kernel/drivers/oss_audioloop keep-old
settings/kernel/drivers/oss_core keep-old
settings/kernel/drivers/oss_cs461x keep-old
settings/kernel/drivers/oss_emu10k1x keep-old
settings/kernel/drivers/oss_envy24 keep-old
settings/kernel/drivers/oss_envy24ht keep-old
settings/kernel/drivers/oss_fmedia keep-old
settings/kernel/drivers/oss_hdaudio keep-old
settings/kernel/drivers/oss_ich keep-old
settings/kernel/drivers/oss_imux keep-old
settings/kernel/drivers/oss_madi keep-old
settings/kernel/drivers/oss_sblive keep-old
settings/kernel/drivers/oss_sbpci keep-old
settings/kernel/drivers/oss_sbxfi keep-old
settings/kernel/drivers/oss_trident keep-old
settings/kernel/drivers/oss_userdev keep-old
settings/kernel/drivers/oss_ymf7xx keep-old
# settings/kernel/drivers directory keep-old
settings/kernel/drivers directory keep-old
"
PROVIDES="
@@ -63,7 +45,6 @@ BUILD_PREREQUIRES="
BUILD()
{
#cd oss-v4.2-build2017-src-bsd
export BEOS_SYSTEM=$prefix
mkdir -p build
cd build
@@ -73,16 +54,9 @@ BUILD()
INSTALL()
{
#cd oss-v4.2-build2017-src-bsd
export BEOS_SYSTEM=$prefix
cd build
if [ -n "${DESTDIR}" ];then
make package
mkdir -p ${DESTDIR}/boot
unzip oss-beos-v4.2-2002.zip -d ${DESTDIR}/boot
else
make install
# they really belong to home/config/settings but well...
copyattr -d -r prototype/boot/home/config/settings/* $settingsDir/
fi
make install
# they really belong to home/config/settings but well...
copyattr -d -r prototype/boot/home/config/settings/* $settingsDir/
}

View File

@@ -1,63 +0,0 @@
SUMMARY="The audio architecture Open Sound System (OSS)"
DESCRIPTION="Open Sound System (OSS) is the first attempt in unifying the \
digital audio architecture for UNIX. OSS is a set of device drivers that \
provide a uniform API across all the major UNIX architectures."
HOMEPAGE="http://developer.opensound.com/"
COPYRIGHT="1996-2008 Hannu Savolainen and Dev Mazumdar"
LICENSE="BSD (2-clause)"
REVISION="2"
srcGitRev="cd2ae052d390c4811acd10553b327bb94fa2abb0"
SOURCE_URI="https://sourceforge.net/code-snapshots/git/o/op/opensound/git.git/opensound-git-$srcGitRev.zip"
CHECKSUM_SHA256="6c4852c4c835f54bc807c91a657ecdc398560e6c0b6fc165464265bc30ea407f"
SOURCE_DIR="opensound-git-$srcGitRev"
PATCHES="opensound-4.2_git.patchset"
ARCHITECTURES="?x86_gcc2 ?x86_64"
GLOBAL_WRITABLE_FILES="
settings/kernel/drivers directory keep-old
"
PROVIDES="
opensound$secondaryArchSuffix = $portVersion
cmd:ossinfo$secondaryArchSuffix
cmd:ossmix$secondaryArchSuffix
cmd:ossphone$secondaryArchSuffix
cmd:ossplay$secondaryArchSuffix
cmd:ossrecord$secondaryArchSuffix
cmd:osstest$secondaryArchSuffix
cmd:savemixer$secondaryArchSuffix
cmd:vmixctl$secondaryArchSuffix
"
REQUIRES="
haiku$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:awk
cmd:find
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
"
BUILD()
{
export BEOS_SYSTEM=$prefix
mkdir -p build
cd build
sh ../configure --config-midi=NO --config-vmix=NO
make
}
INSTALL()
{
export BEOS_SYSTEM=$prefix
cd build
make install
# they really belong to home/config/settings but well...
copyattr -d -r prototype/boot/home/config/settings/* $settingsDir/
}

View File

@@ -1,13 +1,9 @@
From d8152901ee9fefa3d2d6e93f294951c638f1142e Mon Sep 17 00:00:00 2001
From 3dad68c20cee07b80ab1828cda2497bb3c2cf379 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Thu, 7 Aug 2014 22:20:13 +0200
Subject: [PATCH 1/9] Haiku: Fix physical address passing to oss_map_pci_mem()
Subject: Haiku: Fix physical address passing to oss_map_pci_mem()
Avoids sign extension ending in General Protection Exception.
---
kernel/OS/BeOS/os_beos.c | 6 +++---
kernel/OS/BeOS/os_beos.h | 7 +++++--
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/kernel/OS/BeOS/os_beos.c b/kernel/OS/BeOS/os_beos.c
index 08587c5..f29197c 100644
@@ -60,18 +56,15 @@ index 1e8f0b5..f4621e1 100644
#define MAP_PCI_IOADDR(osdev, nr, io) (oss_native_word)io
#define MAP_PCI_MEM(osdev, ix, phaddr, size) oss_map_pci_mem(osdev, ix, phaddr, size)
--
2.15.0
2.19.1
From 035a0250a7d4a5fc34dce12bd33b63651ee0ce35 Mon Sep 17 00:00:00 2001
From 6c247dced4c756f3b73568bc5ca0b15685b358bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Tue, 21 Nov 2017 08:52:04 +0100
Subject: [PATCH 2/9] Haiku: Fix mutex initialization
Subject: Haiku: Fix mutex initialization
Haiku has been defining spinlocks as structs for a while now, unlike BeOS.
---
kernel/OS/BeOS/os_beos.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/kernel/OS/BeOS/os_beos.h b/kernel/OS/BeOS/os_beos.h
index f4621e1..057948e 100644
@@ -93,14 +86,13 @@ index f4621e1..057948e 100644
#define MUTEX_ENTER_IRQDISABLE(mutex, flags) \
{ \
--
2.15.0
2.19.1
From 0901fc45199f2bcb4f9a749dd4406bc2593b2051 Mon Sep 17 00:00:00 2001
From 2d13191c02f54b3c8a0c5702114b10c9a8225fb6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Tue, 21 Nov 2017 09:48:20 +0100
Subject: [PATCH 3/9] Haiku: Fix "decimal constant is so large that it is
unsigned" warning
Subject: Haiku: Fix "decimal constant is so large that it is unsigned" warning
Because Haiku error constants are already negative, and ENOMEM is actually
INT32_MIN, the compiler complains about it.
@@ -115,15 +107,12 @@ int main() {
GEN_ERRNO(E2BIG);
...
}
---
setup/srcconf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup/srcconf.c b/setup/srcconf.c
index 967aed3..300a168 100644
index a829671..90b8491 100644
--- a/setup/srcconf.c
+++ b/setup/srcconf.c
@@ -1370,7 +1370,7 @@ produce_errno_h(void)
@@ -1379,7 +1379,7 @@ produce_errno_h(void)
exit(-1);
}
#define GEN_ERRNO(e) \
@@ -133,17 +122,14 @@ index 967aed3..300a168 100644
fprintf (f, "#ifndef OSS_ERRNO_H\n");
fprintf (f, "#define OSS_ERRNO_H\n");
--
2.15.0
2.19.1
From 9bb90810d582cf56280cd074053c59339b339e75 Mon Sep 17 00:00:00 2001
From 82c17067b9a2b3279c33ade8d9d3b3e9dd3c3e60 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Tue, 21 Nov 2017 10:21:08 +0100
Subject: [PATCH 4/9] Haiku: Fix new type for atomics
Subject: Haiku: Fix new type for atomics
---
kernel/OS/BeOS/os_beos.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/OS/BeOS/os_beos.c b/kernel/OS/BeOS/os_beos.c
index f29197c..3f1366b 100644
@@ -163,20 +149,17 @@ index f29197c..3f1366b 100644
volatile int oss_open_devices = 0;
#define MAX_CARDS 16
--
2.15.0
2.19.1
From 21693820a85c8154c0cdd8654314b3c74f36a091 Mon Sep 17 00:00:00 2001
From a1e8ed41664838542c1ea560c204da9c53500a51 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Tue, 21 Nov 2017 10:22:36 +0100
Subject: [PATCH 5/9] Haiku: Work around PCI->ram_address limitation
Subject: Haiku: Work around PCI->ram_address limitation
Historically it takes a pointer, while it should use a phys_addr_t.
It should be fixed but until then we test for overflow and return directly.
On x86 it's a noop anyway.
---
kernel/OS/BeOS/os_beos.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/kernel/OS/BeOS/os_beos.c b/kernel/OS/BeOS/os_beos.c
index 3f1366b..0f9f3f6 100644
@@ -196,20 +179,17 @@ index 3f1366b..0f9f3f6 100644
--
2.15.0
2.19.1
From f794bd178afb1bf60e995b0b72952b464aadcc45 Mon Sep 17 00:00:00 2001
From 16cbac9874f8bafc55e3ac4e5d35a8b6a56f2213 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Tue, 21 Nov 2017 11:21:20 +0100
Subject: [PATCH 6/9] Haiku: build.sh: Fix and make more flexible for packaging
Subject: Haiku: build.sh: Fix and make more flexible for packaging
Haiku introduced subtle differences from BeOS...
Actually some of this was already fixed in 2014...
---
setup/BeOS/build.sh | 42 +++++++++++++++++++++++++++---------------
1 file changed, 27 insertions(+), 15 deletions(-)
diff --git a/setup/BeOS/build.sh b/setup/BeOS/build.sh
index 045a599..31ae894 100644
@@ -316,18 +296,15 @@ index 045a599..31ae894 100644
#shortver="${longver%% *}"
#appver="${shortver:0:1} ${shortver:0:1} 0 b ${shortver##*[a-z]}"
--
2.15.0
2.19.1
From 07719c25dcc90de43a86652d545160e633bc0a70 Mon Sep 17 00:00:00 2001
From 5334f04f1ccca6d6394d3590add7774853733f25 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Tue, 21 Nov 2017 12:00:47 +0100
Subject: [PATCH 7/9] Haiku: Fix installing paths
Subject: Haiku: Fix installing paths
When creating a package, we expect stuff outside of /boot...
---
setup/BeOS/build.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/setup/BeOS/build.sh b/setup/BeOS/build.sh
index 31ae894..dba8bf5 100644
@@ -345,17 +322,14 @@ index 31ae894..dba8bf5 100644
# the path to the kernel binary we can link to
if [ $OSTYPE = "haiku" ]; then
--
2.15.0
2.19.1
From 8562af6deb4d259cc47c077426d6c8a123f45349 Mon Sep 17 00:00:00 2001
From 88a501aca135bfef61df9bc17a198ae15827cba9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Tue, 21 Nov 2017 13:11:13 +0100
Subject: [PATCH 8/9] Haiku: make sure we preserve symlinks on installing
Subject: Haiku: make sure we preserve symlinks on installing
---
setup/BeOS/make.local | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/setup/BeOS/make.local b/setup/BeOS/make.local
index ca403e9..8b8a101 100644
@@ -374,21 +348,17 @@ index ca403e9..8b8a101 100644
package: build
sh setup/BeOS/mkpkg.sh
--
2.15.0
2.19.1
From 744a138dfaf9b34dcf74eef1eadcbd17488e9a57 Mon Sep 17 00:00:00 2001
From 0589c208d0a1fa3615fd9fc9f231c8ed4879bbcf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Tue, 21 Nov 2017 15:58:22 +0100
Subject: [PATCH 9/9] Haiku: only make an osdev available when pci reservation
worked
Subject: Haiku: only make an osdev available when pci reservation worked
This was fixed in 2014 in f60489 then undone in 58f453 for some reason...
Added a comment to make it more obvious.
---
kernel/OS/BeOS/os_beos.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/kernel/OS/BeOS/os_beos.c b/kernel/OS/BeOS/os_beos.c
index 0f9f3f6..f7e9883 100644
@@ -414,5 +384,110 @@ index 0f9f3f6..f7e9883 100644
* Create the device handle
*/
--
2.15.0
2.19.1
From 42a1fdf52d43a3e29ddbd41820c94982976b0b17 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 27 Jan 2019 20:32:10 +1000
Subject: Haiku: Fixes for SMAP
diff --git a/kernel/OS/BeOS/os_beos.c b/kernel/OS/BeOS/os_beos.c
index f7e9883..e2d34ab 100644
--- a/kernel/OS/BeOS/os_beos.c
+++ b/kernel/OS/BeOS/os_beos.c
@@ -134,8 +134,8 @@ oss_contig_malloc (oss_device_t * osdev, int size, oss_uint64_t memlimit,
size += B_PAGE_SIZE - 1;
size &= ~(B_PAGE_SIZE - 1);
- if ((err = id = create_area(OSS_CONTIG_AREA_NAME, &p, B_ANY_KERNEL_ADDRESS,
- size, lock, 0)) < B_OK)
+ if ((err = id = create_area(OSS_CONTIG_AREA_NAME, &p, B_ANY_KERNEL_ADDRESS, \
+ size, lock, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA )) < B_OK)
{
cmn_err (CE_WARN, "create_area() failed\n");
return NULL;
@@ -616,8 +616,9 @@ oss_map_pci_mem (oss_device_t * osdev, int nr, phys_addr_t phaddr, int size)
size += B_PAGE_SIZE - 1;
size &= ~(B_PAGE_SIZE - 1);
- err = map_physical_memory(OSS_PCI_AREA_NAME, phaddr, size,
- B_ANY_KERNEL_BLOCK_ADDRESS, 0, &va);
+ err = map_physical_memory(OSS_PCI_AREA_NAME, phaddr, size, \
+ B_ANY_KERNEL_BLOCK_ADDRESS, \
+ B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA, &va);
if (err < B_OK)
va = NULL;
FEXITR((uint32)va);
--
2.19.1
From cec7f25ab3067627d723de8bb891b8fef38b6d07 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 27 Jan 2019 23:19:48 +1000
Subject: Haiku: Fix build for x86_64
diff --git a/setup/BeOS/build.sh b/setup/BeOS/build.sh
index dba8bf5..1bf32d7 100644
--- a/setup/BeOS/build.sh
+++ b/setup/BeOS/build.sh
@@ -105,13 +105,18 @@ rm target/modules/oss_midiloop.o
# try to build all in a single bin for now...
# driver_beos.o shouldn' be in, oh well...
# R5 has symbols like __ucmpdi2 but not Haiku, so use libgcc
-gcc -o $core target/objects/*.o target/modules/*.o -nostdlib -lgcc $KERNEL || exit 1
+gcc -fno-strict-aliasing -fno-delete-null-pointer-checks -fno-builtin-fork -fno-builtin-vfork \
+ -shared -nostdlib -Xlinker -soname=$core -z max-page-size=0x1000 -o $core \
+ target/objects/*.o target/modules/*.o $KERNEL -lgcc || exit 1
setvermime $core
# except the loader driver...
# using the same bin works in BeOS but not in Haiku.
drv=prototype/$BEOS_SYSTEM/add-ons/kernel/drivers/bin/${DRVPREFIX}loader
-gcc -o $drv target/objects/driver_beos.o -nostdlib $KERNEL || exit 1
+gcc -fno-strict-aliasing -fno-delete-null-pointer-checks -fno-builtin-fork -fno-builtin-vfork \
+ -shared -nostdlib -Xlinker -soname=$drv -z max-page-size=0x1000 -o $drv \
+ target/objects/driver_beos.o \
+ $KERNEL -lgcc || exit 1
setvermime $drv
rm -f devlist.txt
diff --git a/setup/srcconf_beos.inc b/setup/srcconf_beos.inc
index 8083e50..ddff290 100644
--- a/setup/srcconf_beos.inc
+++ b/setup/srcconf_beos.inc
@@ -3,7 +3,7 @@
static void
check_sysdep (conf_t * conf, struct utsname *un)
{
- strcpy (conf->cplusplus, "g++ -fno-rtti -fno-exceptions -I.");
+ strcpy (conf->cplusplus, "g++ -I.");
/* fixup machine names */
if (strcmp (un->machine, "BePC") == 0)
@@ -13,7 +13,9 @@ check_sysdep (conf_t * conf, struct utsname *un)
if (strcmp (un->machine, "BePC") == 0 ||
strcmp (un->machine, "i386") == 0 ||
strcmp (un->machine, "i486") == 0 ||
- strcmp (un->machine, "i586") == 0 || strcmp (un->machine, "i686") == 0)
+ strcmp (un->machine, "i586") == 0 ||
+ strcmp (un->machine, "i686") == 0 ||
+ strcmp (un->machine, "x86_64") == 0)
{
strcpy (conf->platform, "i86pc");
}
@@ -30,5 +32,7 @@ check_sysdep (conf_t * conf, struct utsname *un)
static void
add_kernel_flags (FILE * f)
{
- fprintf (f, "CFLAGS=-O2 -D_KERNEL -D_KERNEL_MODE=1 -no-fpic\n");
+ fprintf (f, "CFLAGS=-O2 -D_KERNEL -D_KERNEL_MODE=1 \
+ -fno-strict-aliasing -fno-builtin-fork -fno-builtin-vfork \
+ -finline -fno-builtin -ffreestanding -fno-exceptions -fno-omit-frame-pointer\n");
}
--
2.19.1