Add soxr port

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
This commit is contained in:
Timothy Gu
2014-12-20 06:26:59 +00:00
parent 0749956d73
commit 4f02c88f14
2 changed files with 174 additions and 0 deletions

View File

@@ -0,0 +1,99 @@
From c592f1dd795750f36ade845fcd6dcea8d5eaf126 Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Sun, 21 Dec 2014 17:28:56 +0000
Subject: Use stdbool.h and stdint.h if they are present
Fixes building on some exotic platforms like Haiku. Plus it's more
correct any way.
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8a24952..b638184 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -106,7 +106,9 @@ if (WITH_AVFFT)
endif ()
check_function_exists (lrint HAVE_LRINT)
-check_include_files (fenv.h HAVE_FENV_H)
+check_include_files (fenv.h HAVE_FENV_H)
+check_include_files (stdbool.h HAVE_STDBOOL_H)
+check_include_files (stdint.h HAVE_STDINT_H)
test_big_endian (WORDS_BIGENDIAN)
macro (make_exist)
diff --git a/examples/examples-common.h b/examples/examples-common.h
index 585fac3..1474cb5 100644
--- a/examples/examples-common.h
+++ b/examples/examples-common.h
@@ -12,6 +12,8 @@
#include <stdlib.h>
#include <string.h>
+#include "../soxr-config.h"
+
#ifdef _WIN32
/* Work-around for broken file-I/O on MS-Windows: */
#include <io.h>
@@ -25,18 +27,6 @@
#define USE_STD_STDIO
#endif
-#undef int16_t
-#define int16_t short
-
-#undef int32_t
-#if LONG_MAX > 2147483647L
- #define int32_t int
-#elif LONG_MAX < 2147483647L
- #error this programme requires that 'long int' has at least 32-bits
-#else
- #define int32_t long
-#endif
-
#undef min
#undef max
#define min(x,y) ((x)<(y)?(x):(y))
diff --git a/soxr-config.h.in b/soxr-config.h.in
index 227bcfd..d93987b 100644
--- a/soxr-config.h.in
+++ b/soxr-config.h.in
@@ -10,17 +10,23 @@
#define HAVE_SIMD @HAVE_SIMD@
#define HAVE_FENV_H @HAVE_FENV_H@
#define HAVE_LRINT @HAVE_LRINT@
+#define HAVE_STDBOOL_H @HAVE_STDBOOL_H@
+#define HAVE_STDINT_H @HAVE_STDINT_H@
#define WORDS_BIGENDIAN @WORDS_BIGENDIAN@
-#include <limits.h>
-
+#if !HAVE_STDBOOL_H
#undef bool
#undef false
#undef true
#define bool int
#define false 0
#define true 1
+#else /* HAVE_STDBOOL_H */
+#include <stdbool.h>
+#endif
+#if !HAVE_STDINT_H
+#include <limits.h>
#undef int16_t
#undef int32_t
#undef int64_t
@@ -42,5 +48,7 @@
#endif
#define uint32_t unsigned int32_t
#define uint64_t unsigned int64_t
-
+#else /* HAVE_STDINT_H */
+#include <stdint.h>
+#endif
#endif
--
1.8.3.4

View File

@@ -0,0 +1,75 @@
SUMMARY="SoX Resampler library"
DESCRIPTION="SoXR is a high-quality audio resampling library. It handles \
the conversion of audio to different sample rates (most commonly 44100, \
48000, and 96000 Hz). It is one-dimensional and high-quality.
"
HOMEPAGE="https://sourceforge.net/p/soxr/wiki/Home/"
SRC_URI="http://downloads.sourceforge.net/project/soxr/soxr-${portVersion}-Source.tar.xz"
CHECKSUM_SHA256="dcc16868d1a157079316f84233afcc2b52dd0bd541dd8439dc25bceb306faac2"
REVISION="1"
LICENSE="GNU LGPL v2.1"
COPYRIGHT="2007-2013 Rob Sykes <robs@users.sourceforge.net>"
ARCHITECTURES="x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"
PROVIDES="
soxr${secondaryArchSuffix} = $portVersion
lib:libsoxr$secondaryArchSuffix = 0.1.0 compat >= 0
lib:libsoxr_lsr$secondaryArchSuffix = 0.1.9 compat >= 0
"
REQUIRES="
haiku$secondaryArchSuffix
"
BUILD_REQUIRES="
"
BUILD_PREREQUIRES="
haiku${secondaryArchSuffix}_devel
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
"
SOURCE_DIR="soxr-${portVersion}-Source"
PATCHES="soxr-${portVersion}.patchset"
BUILD()
{
cmake . \
-DCMAKE_INSTALL_PREFIX=$prefix \
-DBUILD_TESTS=OFF \
-DBIN_INSTALL_DIR=$binDir \
-DLIB_INSTALL_DIR=$libDir \
-DINCLUDE_INSTALL_DIR=$includeDir \
-DDOC_INSTALL_DIR=$docDir
make $jobArgs
}
INSTALL()
{
make install
# prepare develop/lib
prepareInstalledDevelLibs libsoxr libsoxr-lsr
fixPkgconfig
packageEntries devel \
$developDir
}
# ----- devel package -------------------------------------------------------
PROVIDES_devel="
soxr${secondaryArchSuffix}_devel = $portVersion
devel:libsoxr$secondaryArchSuffix = 0.1.0 compat >= 0
devel:libsoxr_lsr$secondaryArchSuffix = 0.1.9 compat >= 0
"
REQUIRES_devel="
soxr$secondaryArchSuffix == $portVersion base
"