mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 12:10:06 +02:00
libnumbertext: add recipe
This commit is contained in:
63
app-text/libnumbertext/libnumbertext-1.0.3.recipe
Normal file
63
app-text/libnumbertext/libnumbertext-1.0.3.recipe
Normal file
@@ -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
|
||||
}
|
||||
52
app-text/libnumbertext/patches/libnumbertext-1.0.3.patchset
Normal file
52
app-text/libnumbertext/patches/libnumbertext-1.0.3.patchset
Normal file
@@ -0,0 +1,52 @@
|
||||
From 84705e6d45361b1b1f61db4a4e7023f942b0ac0f Mon Sep 17 00:00:00 2001
|
||||
From: Kacper Kasper <kacperkasper@gmail.com>
|
||||
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<wchar_t>));
|
||||
#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 <cstring>
|
||||
+#ifdef __HAIKU__
|
||||
+#include <fs_info.h>
|
||||
+#include <FindDirectory.h>
|
||||
+#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
|
||||
|
||||
Reference in New Issue
Block a user