From 96417477dc0518622a5c60a3ba4bdae5e417f9bd Mon Sep 17 00:00:00 2001 From: Kacper Kasper Date: Fri, 3 Aug 2018 20:40:23 +0200 Subject: [PATCH] libnumbertext: add recipe --- .../libnumbertext/libnumbertext-1.0.3.recipe | 63 +++++++++++++++++++ .../patches/libnumbertext-1.0.3.patchset | 52 +++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 app-text/libnumbertext/libnumbertext-1.0.3.recipe create mode 100644 app-text/libnumbertext/patches/libnumbertext-1.0.3.patchset diff --git a/app-text/libnumbertext/libnumbertext-1.0.3.recipe b/app-text/libnumbertext/libnumbertext-1.0.3.recipe new file mode 100644 index 000000000..2278d997e --- /dev/null +++ b/app-text/libnumbertext/libnumbertext-1.0.3.recipe @@ -0,0 +1,63 @@ +SUMMARY="A library for number to number name conversion" +DESCRIPTION="Numbertext can convert numbers to their names, including cardinal \ +and ordinal numbers, ordinal indicators and money amounts with currencies in \ +more than 40 languages and numeral systems." +HOMEPAGE="https://numbertext.org/" +SOURCE_URI="https://github.com/Numbertext/libnumbertext/releases/download/1.0/libnumbertext-1.0.3.tar.xz" +CHECKSUM_SHA256="b52f6dc468a5cc93d572cf28cab88c6c68bc45e59a0f69e9b327327db3e7e5a5" +COPYRIGHT="2009–2018 László Németh et al." +LICENSE="BSD (3-clause)" +REVISION="1" +PATCHES="libnumbertext-$portVersion.patchset" + +ARCHITECTURES="!x86_gcc2 x86_64" +SECONDARY_ARCHITECTURES="x86" + +libVersion=0.0.0 +libVersionCompat="$libVersion compat >= ${libVersion%%.*}" + +PROVIDES=" + libnumbertext$secondaryArchSuffix = $portVersion + cmd:spellout = $portVersion + lib:libnumbertext_1.0$secondaryArchSuffix = $libVersionCompat + " +REQUIRES=" + haiku$secondaryArchSuffix + " + +PROVIDES_devel=" + libnumbertext${secondaryArchSuffix}_devel = $portVersion + devel:libnumbertext_1.0$secondaryArchSuffix = $libVersion + " +REQUIRES_devel=" + libnumbertext$secondaryArchSuffix == $portVersion base + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + " +BUILD_PREREQUIRES=" + cmd:awk + cmd:cmp + cmd:gcc$secondaryArchSuffix + cmd:make + cmd:pkg_config$secondaryArchSuffix + " + +BUILD() +{ + runConfigure ./configure + make $jobArgs +} + +INSTALL() +{ + make install + + prepareInstalledDevelLibs \ + libnumbertext-1.0 + fixPkgconfig + + packageEntries devel \ + $developDir +} diff --git a/app-text/libnumbertext/patches/libnumbertext-1.0.3.patchset b/app-text/libnumbertext/patches/libnumbertext-1.0.3.patchset new file mode 100644 index 000000000..8f720b187 --- /dev/null +++ b/app-text/libnumbertext/patches/libnumbertext-1.0.3.patchset @@ -0,0 +1,52 @@ +From 84705e6d45361b1b1f61db4a4e7023f942b0ac0f Mon Sep 17 00:00:00 2001 +From: Kacper Kasper +Date: Fri, 3 Aug 2018 20:05:18 +0200 +Subject: Haiku support + + +diff --git a/src/Numbertext.cxx b/src/Numbertext.cxx +index 3527797..fd6a4e9 100644 +--- a/src/Numbertext.cxx ++++ b/src/Numbertext.cxx +@@ -24,7 +24,7 @@ bool readfile(const std::string& filename, std::wstring& result) + std::wifstream wif(filename); + if (wif.fail()) + return false; +-#ifdef _MSC_VER ++#if defined _MSC_VER || defined __HAIKU__ + wif.imbue(std::locale(std::locale(), new std::codecvt_utf8)); + #else + wif.imbue(std::locale("en_US.UTF-8")); +diff --git a/src/spellout.cxx b/src/spellout.cxx +index bcdfd83..d20bb91 100644 +--- a/src/spellout.cxx ++++ b/src/spellout.cxx +@@ -1,6 +1,10 @@ + #include "Numbertext.hxx" + #include "numbertext-version.h" + #include ++#ifdef __HAIKU__ ++#include ++#include ++#endif + + #ifdef HAVE_BOOST_REGEX + using namespace boost; +@@ -40,6 +44,14 @@ int main(int argc, char* argv[]) + paths.emplace_back(""); + paths.emplace_back(DEFPATH); + paths.emplace_back(DEFPATH2); ++#ifdef __HAIKU__ ++ dev_t volume = dev_for_path("/boot"); ++ char buffer[B_PATH_NAME_LENGTH+B_FILE_NAME_LENGTH]; ++ find_directory(B_SYSTEM_DATA_DIRECTORY, volume, false, buffer, sizeof(buffer)); ++ paths.emplace_back(std::string(buffer) + "/libnumbertext/"); ++ find_directory(B_USER_DATA_DIRECTORY, volume, false, buffer, sizeof(buffer)); ++ paths.emplace_back(std::string(buffer) + "/libnumbertext/"); ++#endif + + if (getenv(PATH)) + paths.insert(paths.begin() + 1, std::string(getenv(PATH)) + "/"); +-- +2.16.4 +