mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-22 03:30:05 +02:00
Add recipe and patch for libspectrum.
This commit is contained in:
66
app-emulation/libspectrum/libspectrum-1.1.1.recipe
Normal file
66
app-emulation/libspectrum/libspectrum-1.1.1.recipe
Normal file
@@ -0,0 +1,66 @@
|
||||
SUMMARY="Emulator support library"
|
||||
DESCRIPTION="Library designed to make the input and output of some ZX Spectrum \
|
||||
emulator files slightly easier. It is intended to be usable on Unix variants, \
|
||||
Win32 and Mac OS X. Currently, it is mainly (only?) used by Fuse, but other \
|
||||
Spectrum emulator and utility authors are encouraged to use it."
|
||||
REVISION="1"
|
||||
HOMEPAGE="http://fuse-emulator.sourceforge.net/libspectrum.php"
|
||||
LICENSE="GNU GPL v2"
|
||||
ARCHITECTURES="x86_gcc2"
|
||||
COPYRIGHT="2003-2013 Philip Kendall and libspectrum contributors"
|
||||
|
||||
SRC_URI="http://sourceforge.net/projects/fuse-emulator/files/libspectrum/1.1.1/libspectrum-1.1.1.tar.gz"
|
||||
CHECKSUM_SHA256="178d3607af2109b6b8dafac4f91912745b9f3c087319945c3a886bb7fe7989d5"
|
||||
PATCHES="libspectrum-$portVersion.patchset"
|
||||
|
||||
PROVIDES="
|
||||
libspectrum = $portVersion
|
||||
lib:libspectrum = 8.1.0 compat >= 8
|
||||
"
|
||||
|
||||
REQUIRES="
|
||||
haiku
|
||||
lib:libbz2
|
||||
lib:libz
|
||||
"
|
||||
|
||||
|
||||
PROVIDES_devel="
|
||||
libspectrum_devel = $portVersion
|
||||
devel:libspectrum = 8.1.0 compat >= 8
|
||||
"
|
||||
|
||||
REQUIRES_devel="
|
||||
libspectrum == $portVersion base
|
||||
"
|
||||
|
||||
|
||||
BUILD_REQUIRES="
|
||||
haiku_devel
|
||||
devel:libbz2
|
||||
devel:libgcrypt
|
||||
devel:libz
|
||||
"
|
||||
|
||||
BUILD_PREREQUIRES="
|
||||
cmd:awk
|
||||
cmd:gcc
|
||||
cmd:make
|
||||
cmd:perl
|
||||
cmd:pkg_config
|
||||
"
|
||||
|
||||
BUILD()
|
||||
{
|
||||
runConfigure ./configure
|
||||
make $jobArgs
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
make install
|
||||
|
||||
prepareInstalledDevelLib libspectrum
|
||||
|
||||
packageEntries devel $developDir
|
||||
}
|
||||
123
app-emulation/libspectrum/patches/libspectrum-1.1.1.patchset
Normal file
123
app-emulation/libspectrum/patches/libspectrum-1.1.1.patchset
Normal file
@@ -0,0 +1,123 @@
|
||||
From 3e80dac7bfb6f5c24a75eef84a787bf3204a00cf Mon Sep 17 00:00:00 2001
|
||||
From: Adrien Destugues <pulkomandy@gmail.com>
|
||||
Date: Tue, 12 May 2015 18:41:28 +0200
|
||||
Subject: C89 "declaration after statement" fixes.
|
||||
|
||||
|
||||
diff --git a/pzx_read.c b/pzx_read.c
|
||||
index 64ea969..cbdae60 100644
|
||||
--- a/pzx_read.c
|
||||
+++ b/pzx_read.c
|
||||
@@ -238,6 +238,15 @@ read_data_block( libspectrum_tape *tape, const libspectrum_byte **buffer,
|
||||
libspectrum_byte *data;
|
||||
|
||||
libspectrum_error error;
|
||||
+ libspectrum_dword count;
|
||||
+ int initial_level;
|
||||
+ size_t count_bytes;
|
||||
+ size_t bits_in_last_byte;
|
||||
+ libspectrum_word tail;
|
||||
+ libspectrum_byte p0_count;
|
||||
+ libspectrum_byte p1_count;
|
||||
+ libspectrum_word *p0_pulses;
|
||||
+ libspectrum_word *p1_pulses;
|
||||
|
||||
/* Check there's enough left in the buffer for all the metadata */
|
||||
if( data_length < 8 ) {
|
||||
@@ -249,16 +258,16 @@ read_data_block( libspectrum_tape *tape, const libspectrum_byte **buffer,
|
||||
}
|
||||
|
||||
/* Get the metadata */
|
||||
- libspectrum_dword count = libspectrum_read_dword( buffer );
|
||||
- int initial_level = !!(count & 0x80000000);
|
||||
+ count = libspectrum_read_dword( buffer );
|
||||
+ initial_level = !!(count & 0x80000000);
|
||||
count &= 0x7fffffff;
|
||||
- size_t count_bytes = ceil( count / (double)LIBSPECTRUM_BITS_IN_BYTE );
|
||||
- size_t bits_in_last_byte =
|
||||
+ count_bytes = ceil( count / (double)LIBSPECTRUM_BITS_IN_BYTE );
|
||||
+ bits_in_last_byte =
|
||||
count % LIBSPECTRUM_BITS_IN_BYTE ?
|
||||
count % LIBSPECTRUM_BITS_IN_BYTE : LIBSPECTRUM_BITS_IN_BYTE;
|
||||
- libspectrum_word tail = libspectrum_read_word( buffer );
|
||||
- libspectrum_byte p0_count = **buffer; (*buffer)++;
|
||||
- libspectrum_byte p1_count = **buffer; (*buffer)++;
|
||||
+ tail = libspectrum_read_word( buffer );
|
||||
+ p0_count = **buffer; (*buffer)++;
|
||||
+ p1_count = **buffer; (*buffer)++;
|
||||
|
||||
/* need to confirm that we have enough length left for the pulse definitions
|
||||
*/
|
||||
@@ -270,13 +279,11 @@ read_data_block( libspectrum_tape *tape, const libspectrum_byte **buffer,
|
||||
return LIBSPECTRUM_ERROR_CORRUPT;
|
||||
}
|
||||
|
||||
- libspectrum_word *p0_pulses;
|
||||
error = pzx_read_data( buffer, block_end,
|
||||
p0_count * sizeof( libspectrum_word ),
|
||||
(libspectrum_byte**)&p0_pulses );
|
||||
if( error ) return error;
|
||||
|
||||
- libspectrum_word *p1_pulses;
|
||||
error = pzx_read_data( buffer, block_end,
|
||||
p1_count * sizeof( libspectrum_word ),
|
||||
(libspectrum_byte**)&p1_pulses );
|
||||
@@ -462,6 +469,7 @@ read_stop_block( libspectrum_tape *tape, const libspectrum_byte **buffer,
|
||||
pzx_context *ctx )
|
||||
{
|
||||
libspectrum_tape_block *block;
|
||||
+ libspectrum_word flags;
|
||||
|
||||
if( data_length < 2 ) {
|
||||
libspectrum_print_error( LIBSPECTRUM_ERROR_CORRUPT,
|
||||
@@ -469,7 +477,7 @@ read_stop_block( libspectrum_tape *tape, const libspectrum_byte **buffer,
|
||||
return LIBSPECTRUM_ERROR_CORRUPT;
|
||||
}
|
||||
|
||||
- libspectrum_word flags = libspectrum_read_word( buffer );
|
||||
+ flags = libspectrum_read_word( buffer );
|
||||
|
||||
if( flags == PZXF_STOP48 ) {
|
||||
block = libspectrum_tape_block_alloc( LIBSPECTRUM_TAPE_BLOCK_STOP48 );
|
||||
diff --git a/szx.c b/szx.c
|
||||
index 214184a..cf8bb8d 100644
|
||||
--- a/szx.c
|
||||
+++ b/szx.c
|
||||
@@ -577,10 +577,12 @@ read_crtr_chunk( libspectrum_snap *snap, libspectrum_word version GCC_UNUSED,
|
||||
/* This is ugly, but I can't see a better way to do it */
|
||||
if( sizeof( libspectrum_byte ) == sizeof( char ) ) {
|
||||
char *custom = libspectrum_malloc( data_length + 1 );
|
||||
+ char *libspectrum;
|
||||
+
|
||||
memcpy( custom, *buffer, data_length );
|
||||
custom[data_length] = 0;
|
||||
|
||||
- char *libspectrum = strstr( custom, libspectrum_string );
|
||||
+ libspectrum = strstr( custom, libspectrum_string );
|
||||
if( libspectrum ) {
|
||||
int matches, v1, v2, v3;
|
||||
libspectrum += strlen( libspectrum_string );
|
||||
diff --git a/tzx_write.c b/tzx_write.c
|
||||
index 8dec404..1981ea1 100644
|
||||
--- a/tzx_write.c
|
||||
+++ b/tzx_write.c
|
||||
@@ -970,6 +970,7 @@ tzx_write_data_block( libspectrum_tape_block *block, libspectrum_byte **buffer,
|
||||
{
|
||||
libspectrum_tape_block *pure_data;
|
||||
size_t data_length;
|
||||
+ libspectrum_byte *data;
|
||||
|
||||
/* Pure data block can only have two identical pulses for bit 0 and bit 1 */
|
||||
if( libspectrum_tape_block_bit0_pulse_count( block ) != 2 ||
|
||||
@@ -998,7 +999,7 @@ tzx_write_data_block( libspectrum_tape_block *block, libspectrum_byte **buffer,
|
||||
/* And the actual data */
|
||||
data_length = libspectrum_tape_block_data_length( block );
|
||||
libspectrum_tape_block_set_data_length( pure_data, data_length );
|
||||
- libspectrum_byte *data = libspectrum_malloc( data_length * sizeof( *data ) );
|
||||
+ data = libspectrum_malloc( data_length * sizeof( *data ) );
|
||||
memcpy( data, libspectrum_tape_block_data( block ), data_length );
|
||||
libspectrum_tape_block_set_data( pure_data, data );
|
||||
|
||||
--
|
||||
2.2.2
|
||||
|
||||
Reference in New Issue
Block a user