From 2f8cffd7e88e5adb9b7fc15dc0234514001f619a Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Fri, 26 Feb 2016 22:14:19 +0100 Subject: [PATCH] Add HxC floppy emulator tools and libraries. --- .../hxcfloppyemulator_cmdline-2.0.0.0.recipe | 47 ++++++++++ ...hxcfloppyemulator_cmdline-2.0.0.0.patchset | 35 +++++++ sys-block/libhxcfe/libhxcfe-2.4.6.0.recipe | 93 +++++++++++++++++++ .../patches/libhxcadaptor-2.4.6.0.patchset | 25 +++++ .../patches/libhxcfe-2.4.6.0.patchset | 24 +++++ .../libusbhxcfe/libusbhxcfe-2.0.0.4.recipe | 62 +++++++++++++ .../patches/libusbhxcfe-2.0.0.4.patchset | 52 +++++++++++ 7 files changed, 338 insertions(+) create mode 100644 sys-block/hxcfloppyemulator_cmdline/hxcfloppyemulator_cmdline-2.0.0.0.recipe create mode 100644 sys-block/hxcfloppyemulator_cmdline/patches/hxcfloppyemulator_cmdline-2.0.0.0.patchset create mode 100644 sys-block/libhxcfe/libhxcfe-2.4.6.0.recipe create mode 100644 sys-block/libhxcfe/patches/libhxcadaptor-2.4.6.0.patchset create mode 100644 sys-block/libhxcfe/patches/libhxcfe-2.4.6.0.patchset create mode 100644 sys-block/libusbhxcfe/libusbhxcfe-2.0.0.4.recipe create mode 100644 sys-block/libusbhxcfe/patches/libusbhxcfe-2.0.0.4.patchset diff --git a/sys-block/hxcfloppyemulator_cmdline/hxcfloppyemulator_cmdline-2.0.0.0.recipe b/sys-block/hxcfloppyemulator_cmdline/hxcfloppyemulator_cmdline-2.0.0.0.recipe new file mode 100644 index 000000000..f58fbcac6 --- /dev/null +++ b/sys-block/hxcfloppyemulator_cmdline/hxcfloppyemulator_cmdline-2.0.0.0.recipe @@ -0,0 +1,47 @@ +SUMMARY="Command-line tools for the HxC floppy emulator" +DESCRIPTION="Tools for manipulating and converting floppy disk images in the +HFE format used by the HxC floppy emulator, and driving the USB version of the +emulator." +HOMEPAGE="http://hxc2001.com/" +COPYRIGHT="2006-2016 Jean-François Del Nero" +LICENSE="GNU GPL v3" +SOURCE_URI="https://github.com/jfdelnero/HxCFloppyEmulator_cmdline/archive/HxCFloppyEmulator_cmdline_V2_0_0_0.tar.gz" +CHECKSUM_SHA256="db022b6c280b515c5c413903d885caa48097d67347eda017341beef8859e097b" +SOURCE_DIR="HxCFloppyEmulator_cmdline-HxCFloppyEmulator_cmdline_V2_0_0_0" +PATCHES="hxcfloppyemulator_cmdline-2.0.0.0.patchset" +REVISION="1" + +ARCHITECTURES="!x86_gcc2 ?x86 ?x86_64" +SECONDARY_ARCHITECTURES="x86" + +PROVIDES=" + hxcfloppyemulator_cmdline$secondaryArchSuffix = $portVersion + cmd:hxcfe$secondaryArchSuffix + " +REQUIRES=" + haiku$secondaryArchSuffix + lib:libhxcfe$secondaryArchSuffix + lib:libusbhxcfe$secondaryArchSuffix + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libhxcfe$secondaryArchSuffix + devel:libusbhxcfe$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:make + cmd:gcc$secondaryArchSuffix + " + +BUILD() +{ + cd build + make $jobArgs +} + +INSTALL() +{ + mkdir -p $binDir + cp build/hxcfe $binDir +} diff --git a/sys-block/hxcfloppyemulator_cmdline/patches/hxcfloppyemulator_cmdline-2.0.0.0.patchset b/sys-block/hxcfloppyemulator_cmdline/patches/hxcfloppyemulator_cmdline-2.0.0.0.patchset new file mode 100644 index 000000000..8259c942f --- /dev/null +++ b/sys-block/hxcfloppyemulator_cmdline/patches/hxcfloppyemulator_cmdline-2.0.0.0.patchset @@ -0,0 +1,35 @@ +From 881f818c3765de2d90e463c294b7975ee8147d36 Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Sat, 27 Feb 2016 09:32:56 +0100 +Subject: Haiku hacks + + +diff --git a/build/Makefile b/build/Makefile +index a8b417c..1b8e939 100644 +--- a/build/Makefile ++++ b/build/Makefile +@@ -9,6 +9,10 @@ LDFLAGS=-lc -lm -ldl -lpthread + LIBHXCFE = libhxcfe.so + LIBUSBHXCFE = libusbhxcfe.so + ++ifeq ($(UNAME), Haiku) ++LDFLAGS= ++endif ++ + ifeq ($(UNAME), Darwin) + CFLAGS += -arch i386 + LDFLAGS += -arch i386 +@@ -29,8 +33,8 @@ EXEC=hxcfe + + all: $(EXEC) + +-hxcfe: hxcfe.o ../../../build/libhxcadaptor.a $(LIBHXCFE) $(LIBUSBHXCFE) +- $(CC) -o $@ $^ $(LDFLAGS) ++hxcfe: hxcfe.o ++ $(CC) -o $@ -lhxcadaptor -lhxcfe -lusbhxcfe $^ $(LDFLAGS) + cp $@ ../../../build + + $(LIBHXCFE): ../../../build/$(LIBHXCFE) +-- +2.7.0 + diff --git a/sys-block/libhxcfe/libhxcfe-2.4.6.0.recipe b/sys-block/libhxcfe/libhxcfe-2.4.6.0.recipe new file mode 100644 index 000000000..62db74269 --- /dev/null +++ b/sys-block/libhxcfe/libhxcfe-2.4.6.0.recipe @@ -0,0 +1,93 @@ +SUMMARY="Manage floppy disk image formats" +DESCRIPTION="The HxC floppy emulator is a device that replaces a floppy drive \ +and allows to use an SD card or USB drive instead of old floppies. This library \ +allows to manage floppy image in the HFE format used by the emulator, as well \ +as several other common floppy image formats." +HOMEPAGE="https://hxc2001.free.fr" +COPYRIGHT="2006-2016 Jean-François Del Nero" +LICENSE="GNU GPL v3" +SOURCE_URI="https://github.com/jfdelnero/libhxcfe/archive/libhxcfe_V2_4_6_0.tar.gz" +CHECKSUM_SHA256="af37d7fb7cd7634af287b8795bf22d6511097cb8666b82baaa05cf6c646f7b7e" +SOURCE_DIR="libhxcfe-libhxcfe_V2_4_6_0" +PATCHES="libhxcfe-$portVersion.patchset" + +SOURCE_URI_2="https://github.com/jfdelnero/libhxcadaptor/archive/libhxcadaptor_V2_0_0_5.tar.gz" +CHECKSUM_SHA256_2="2777d2d86a93113dfc3502e3fb7f2f179aa84a94712947c68374c379336185ad" +SOURCE_DIR_2="libhxcadaptor-libhxcadaptor_V2_0_0_5" +PATCHES_2="libhxcadaptor-$portVersion.patchset" + +SOURCE_URI_3="https://github.com/jfdelnero/libusbhxcfe/archive/libusbhxcfe_V2_0_0_4.tar.gz" +CHECKSUM_SHA256_3="41c16f6539ec6cd6da6c76c94945092d440be4870ff81f308e946e6dfe10e866" +SOURCE_DIR_3="libusbhxcfe-libusbhxcfe_V2_0_0_4" + +REVISION="1" + +ARCHITECTURES="!x86_gcc2 ?x86 ?x86_64" +SECONDARY_ARCHITECTURES="x86" + +PROVIDES=" + libhxcfe$secondaryArchSuffix = $portVersion + lib:libhxcfe$secondaryArchSuffix + " +REQUIRES=" + haiku$secondaryArchSuffix + " + +PROVIDES_devel=" + libhxcfe${secondaryArchSuffix}_devel = $portVersion + devel:libhxcfe$secondaryArchSuffix + devel:libhxcadaptor$secondaryArchSuffix + " +REQUIRES_devel=" + haiku${secondaryArchSuffix}_devel + libhxcfe$secondaryArchSuffix == $portVersion base + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + " +BUILD_PREREQUIRES=" + cmd:dos2unix + cmd:make + cmd:gcc$secondaryArchSuffix + " + +BUILD() +{ + # Prepare directories so the sub-projects can see each other… + mkdir -p ../../libhxcadaptor + ln -sf ../sources-2/libhxcadaptor-libhxcadaptor_V2_0_0_5 ../../libhxcadaptor/trunk + + mkdir -p ../../libusbhxcfe + ln -sf ../sources-3/libusbhxcfe-libusbhxcfe_V2_0_0_4 ../../libusbhxcfe/trunk + + mkdir -p ../../libhxcfe + ln -sf ../sources/libhxcfe-libhxcfe_V2_4_6_0 ../../libhxcfe/trunk + + # Prepare the output dir where all .a files will be put… + mkdir -p ../../build + + # Build platform abstraction layer… + pushd ../../sources-2/libhxcadaptor-libhxcadaptor_V2_0_0_5/build + make $jobArgs + popd + + # Build floppy image management library… + cd build + make $jobArgs +} + +INSTALL() +{ + mkdir -p $libDir $includeDir $includeDir/tracks + + cp ../../build/*.* $libDir + cp ../../sources-2/*/sources/*.h $includeDir + cp sources/*.h $includeDir + cp sources/tracks/*.h $includeDir/tracks/ + + prepareInstalledDevelLibs \ + libhxcfe libhxcadaptor + packageEntries devel \ + $developDir +} diff --git a/sys-block/libhxcfe/patches/libhxcadaptor-2.4.6.0.patchset b/sys-block/libhxcfe/patches/libhxcadaptor-2.4.6.0.patchset new file mode 100644 index 000000000..a78b48553 --- /dev/null +++ b/sys-block/libhxcfe/patches/libhxcadaptor-2.4.6.0.patchset @@ -0,0 +1,25 @@ +From df5201e4f4eaec5f4012bf5d63ac1680d84cc836 Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Sat, 27 Feb 2016 09:18:23 +0100 +Subject: Fix Haiku build. + + +diff --git a/sources/libhxcadaptor.c b/sources/libhxcadaptor.c +index 253f7a4..c64906b 100644 +--- a/sources/libhxcadaptor.c ++++ b/sources/libhxcadaptor.c +@@ -241,9 +241,11 @@ int hxc_createthread(HXCFLOPPYEMULATOR* floppycontext,void* hwcontext,THREADFUNC + + pthread_attr_init(&threadattrib); + ++#ifndef __HAIKU__ + pthread_attr_setinheritsched(&threadattrib, PTHREAD_EXPLICIT_SCHED); + + pthread_attr_setschedpolicy(&threadattrib,SCHED_FIFO); ++#endif + param.sched_priority = sched_get_priority_max(SCHED_FIFO); + /* set the new scheduling param */ + pthread_attr_setschedparam (&threadattrib, ¶m); +-- +2.7.0 + diff --git a/sys-block/libhxcfe/patches/libhxcfe-2.4.6.0.patchset b/sys-block/libhxcfe/patches/libhxcfe-2.4.6.0.patchset new file mode 100644 index 000000000..b1d008b3c --- /dev/null +++ b/sys-block/libhxcfe/patches/libhxcfe-2.4.6.0.patchset @@ -0,0 +1,24 @@ +From a2586c9c4ebe44562714a1e9c8ea3cefea4de0e6 Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Fri, 26 Feb 2016 21:52:58 +0100 +Subject: Add Haiku support. + + +diff --git a/build/Makefile b/build/Makefile +index 2aacd3a..caffc11 100644 +--- a/build/Makefile ++++ b/build/Makefile +@@ -22,6 +22,10 @@ ifeq ($(UNAME), Linux) + CFLAGS += -fPIC + endif + ++ifeq ($(UNAME), Haiku) ++LDFLAGS= -g -shared ++endif ++ + ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN) + LDFLAGS= -g -shared -lc -lm -ldl + EXEC=libhxcfe.dll +-- +2.7.0 + diff --git a/sys-block/libusbhxcfe/libusbhxcfe-2.0.0.4.recipe b/sys-block/libusbhxcfe/libusbhxcfe-2.0.0.4.recipe new file mode 100644 index 000000000..d246aa0bc --- /dev/null +++ b/sys-block/libusbhxcfe/libusbhxcfe-2.0.0.4.recipe @@ -0,0 +1,62 @@ +SUMMARY="CPLD based USB HxC Floppy Emulator HAL library" +DESCRIPTION="The USB HxC floppy emulator is a device that connects to a modern +computer with USB on one side and emulates a Shugart floppy drive on the other +side. It allows transferring files from and to old computers in a simple way +and without using obsolete storage media." +HOMEPAGE="http://hxc2001.com" +COPYRIGHT="2006-2016 JEan-François Del Nero" +LICENSE="GNU GPL v3" +SOURCE_URI="https://github.com/jfdelnero/libusbhxcfe/archive/libusbhxcfe_V2_0_0_4.tar.gz" +CHECKSUM_SHA256="41c16f6539ec6cd6da6c76c94945092d440be4870ff81f308e946e6dfe10e866" +SOURCE_DIR="libusbhxcfe-libusbhxcfe_V2_0_0_4" +PATCHES="libusbhxcfe-2.0.0.4.patchset" +REVISION="1" + +ARCHITECTURES="!x86_gcc2 ?x86 ?x86_64" +SECONDARY_ARCHITECTURES="x86" + +PROVIDES=" + libusbhxcfe$secondaryArchSuffix = $portVersion + lib:libusbhxcfe$secondaryArchSuffix + " +REQUIRES=" + haiku$secondaryArchSuffix + " + +PROVIDES_devel=" + libsbhxcfe${secondaryArchSuffix}_devel = $portVersion + devel:libusbhxcfe$secondaryArchSuffix + " +REQUIRES_devel=" + haiku${secondaryArchSuffix}_devel + libusbhxcfe$secondaryArchSuffix == $portVersion base + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libhxcfe$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:make + cmd:gcc$secondaryArchSuffix + " + +BUILD() +{ + cd build + make $jobArgs +} + +INSTALL() +{ + mkdir -p $libDir + mkdir -p $includeDir + + cp build/*.so $libDir + cp sources/*.h $includeDir + + prepareInstalledDevelLibs \ + libusbhxcfe + packageEntries devel \ + $developDir +} diff --git a/sys-block/libusbhxcfe/patches/libusbhxcfe-2.0.0.4.patchset b/sys-block/libusbhxcfe/patches/libusbhxcfe-2.0.0.4.patchset new file mode 100644 index 000000000..a03752a3f --- /dev/null +++ b/sys-block/libusbhxcfe/patches/libusbhxcfe-2.0.0.4.patchset @@ -0,0 +1,52 @@ +From e61db96bc5ba7ed32d455f1408b46b8a93f499c6 Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Sat, 27 Feb 2016 09:36:52 +0100 +Subject: Fix Haiku build. + + +diff --git a/build/Makefile b/build/Makefile +index 9d37914..dcde088 100644 +--- a/build/Makefile ++++ b/build/Makefile +@@ -16,6 +16,10 @@ ifeq ($(UNAME), Linux) + CFLAGS += -fPIC + endif + ++ifeq ($(UNAME), Haiku) ++LDFLAGS= -g -shared ++endif ++ + ifeq ($(UNAME), Darwin) + CFLAGS += -arch i386 -mmacosx-version-min=10.5 + LDFLAGS += -arch i386 -dynamiclib -current_version 2.0 -install_name @executable_path/../Frameworks/libusbhxcfe.dylib -mmacosx-version-min=10.5 +-- +2.7.0 + + +From 439fe6a0cc1121e347312ff2212af83037ee95ba Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Sat, 27 Feb 2016 10:04:16 +0100 +Subject: Haiku hacks. + + +diff --git a/sources/ftdi.c b/sources/ftdi.c +index 52874cc..6c53666 100644 +--- a/sources/ftdi.c ++++ b/sources/ftdi.c +@@ -249,11 +249,13 @@ int createlistenerthread(RDTHREADFUNCTION thread,int priority,ftdi_context ftdih + + //pthread_attr_create(&threadattrib); + pthread_attr_init(&threadattrib); ++#ifndef __HAIKU__ + pthread_attr_setinheritsched(&threadattrib,PTHREAD_EXPLICIT_SCHED); + //pthread_attr_setsched(&threadattrib,SCHED_FIFO); + //pthread_attr_setprio(&threadattrib,4); + + pthread_attr_setschedpolicy(&threadattrib,SCHED_FIFO); ++#endif + param.sched_priority = sched_get_priority_max(SCHED_FIFO) ; + /* set the new scheduling param */ + pthread_attr_setschedparam (&threadattrib, ¶m); +-- +2.7.0 +