forked from premiere/premiere-libtorrent
add iconv build option
This commit is contained in:
parent
1088c5aa6f
commit
e959acae42
12
Jamfile
12
Jamfile
|
@ -120,6 +120,11 @@ rule linking ( properties * )
|
||||||
result += <library>librt ;
|
result += <library>librt ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if <iconv>on in $(properties)
|
||||||
|
{
|
||||||
|
result += <library>libiconv ;
|
||||||
|
}
|
||||||
|
|
||||||
if <tcmalloc>yes in $(properties)
|
if <tcmalloc>yes in $(properties)
|
||||||
{
|
{
|
||||||
result += <library>tcmalloc ;
|
result += <library>tcmalloc ;
|
||||||
|
@ -233,6 +238,10 @@ feature need-librt : no yes : composite propagated link-incompatible ;
|
||||||
feature fiemap : off on : composite propagated ;
|
feature fiemap : off on : composite propagated ;
|
||||||
feature.compose <fiemap>on : <define>HAVE_LINUX_FIEMAP_H ;
|
feature.compose <fiemap>on : <define>HAVE_LINUX_FIEMAP_H ;
|
||||||
|
|
||||||
|
feature iconv : auto on off : composite propagated ;
|
||||||
|
feature.compose <iconv>on : <define>TORRENT_USE_ICONV=1 ;
|
||||||
|
feature.compose <iconv>off : <define>TORRENT_USE_ICONV=0 ;
|
||||||
|
|
||||||
feature full-stats : on off : composite propagated link-incompatible ;
|
feature full-stats : on off : composite propagated link-incompatible ;
|
||||||
feature.compose <full-stats>off : <define>TORRENT_DISABLE_FULL_STATS ;
|
feature.compose <full-stats>off : <define>TORRENT_DISABLE_FULL_STATS ;
|
||||||
|
|
||||||
|
@ -328,6 +337,9 @@ lib gdi32 : : <name>gdi32 ;
|
||||||
# required for networking on beos
|
# required for networking on beos
|
||||||
lib netkit : : <name>net <search>/boot/system/lib <link>shared ;
|
lib netkit : : <name>net <search>/boot/system/lib <link>shared ;
|
||||||
|
|
||||||
|
# when using iconv
|
||||||
|
lib libiconv : : <name>iconv <link>shared ;
|
||||||
|
|
||||||
local boost-library-search-path =
|
local boost-library-search-path =
|
||||||
<search>/opt/local/lib
|
<search>/opt/local/lib
|
||||||
<search>/usr/lib
|
<search>/usr/lib
|
||||||
|
|
|
@ -357,6 +357,12 @@ Build features:
|
||||||
| | * ``off`` - only collects the standard stats for |
|
| | * ``off`` - only collects the standard stats for |
|
||||||
| | upload and download rate. |
|
| | upload and download rate. |
|
||||||
+--------------------------+----------------------------------------------------+
|
+--------------------------+----------------------------------------------------+
|
||||||
|
| ``iconv`` | * ``auto`` - use iconv for string conversions for |
|
||||||
|
| | linux and mingw and other posix platforms. |
|
||||||
|
| | * ``on`` - force use of iconv |
|
||||||
|
| | * ``off`` - force not using iconv (disables locale |
|
||||||
|
| | awareness except on windows). |
|
||||||
|
+--------------------------+----------------------------------------------------+
|
||||||
|
|
||||||
.. _MaxMind: http://www.maxmind.com/app/api
|
.. _MaxMind: http://www.maxmind.com/app/api
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
// (disables some float-dependent APIs)
|
// (disables some float-dependent APIs)
|
||||||
#define TORRENT_NO_FPU 1
|
#define TORRENT_NO_FPU 1
|
||||||
#define TORRENT_USE_I2P 0
|
#define TORRENT_USE_I2P 0
|
||||||
|
#ifndef TORRENT_USE_ICONV
|
||||||
#define TORRENT_USE_ICONV 0
|
#define TORRENT_USE_ICONV 0
|
||||||
|
#endif
|
||||||
|
|
||||||
// ==== Darwin/BSD ===
|
// ==== Darwin/BSD ===
|
||||||
#elif (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ \
|
#elif (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ \
|
||||||
|
@ -131,8 +133,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
// we don't need iconv on mac, because
|
// we don't need iconv on mac, because
|
||||||
// the locale is always utf-8
|
// the locale is always utf-8
|
||||||
#if defined __APPLE__
|
#if defined __APPLE__
|
||||||
|
#ifndef TORRENT_USE_ICONV
|
||||||
#define TORRENT_USE_ICONV 0
|
#define TORRENT_USE_ICONV 0
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#define TORRENT_HAS_FALLOCATE 0
|
#define TORRENT_HAS_FALLOCATE 0
|
||||||
|
|
||||||
// ==== LINUX ===
|
// ==== LINUX ===
|
||||||
|
@ -143,7 +147,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#elif defined __MINGW32__
|
#elif defined __MINGW32__
|
||||||
#define TORRENT_MINGW
|
#define TORRENT_MINGW
|
||||||
#define TORRENT_WINDOWS
|
#define TORRENT_WINDOWS
|
||||||
|
#ifndef TORRENT_USE_ICONV
|
||||||
#define TORRENT_USE_ICONV 1
|
#define TORRENT_USE_ICONV 1
|
||||||
|
#endif
|
||||||
#define TORRENT_USE_RLIMIT 0
|
#define TORRENT_USE_RLIMIT 0
|
||||||
|
|
||||||
// ==== WINDOWS ===
|
// ==== WINDOWS ===
|
||||||
|
@ -152,7 +158,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
// windows has its own functions to convert
|
// windows has its own functions to convert
|
||||||
// apple uses utf-8 as its locale, so no conversion
|
// apple uses utf-8 as its locale, so no conversion
|
||||||
// is necessary
|
// is necessary
|
||||||
|
#ifndef TORRENT_USE_ICONV
|
||||||
#define TORRENT_USE_ICONV 0
|
#define TORRENT_USE_ICONV 0
|
||||||
|
#endif
|
||||||
#define TORRENT_USE_RLIMIT 0
|
#define TORRENT_USE_RLIMIT 0
|
||||||
#define TORRENT_HAS_FALLOCATE 0
|
#define TORRENT_HAS_FALLOCATE 0
|
||||||
|
|
||||||
|
@ -167,7 +175,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <storage/StorageDefs.h> // B_PATH_NAME_LENGTH
|
#include <storage/StorageDefs.h> // B_PATH_NAME_LENGTH
|
||||||
#define TORRENT_HAS_FALLOCATE 0
|
#define TORRENT_HAS_FALLOCATE 0
|
||||||
#define TORRENT_USE_MLOCK 0
|
#define TORRENT_USE_MLOCK 0
|
||||||
|
#ifndef TORRENT_USE_ICONV
|
||||||
#define TORRENT_USE_ICONV 0
|
#define TORRENT_USE_ICONV 0
|
||||||
|
#endif
|
||||||
#if __GNUCC__ == 2
|
#if __GNUCC__ == 2
|
||||||
# if defined(TORRENT_BUILDING_SHARED)
|
# if defined(TORRENT_BUILDING_SHARED)
|
||||||
# define TORRENT_EXPORT __declspec(dllexport)
|
# define TORRENT_EXPORT __declspec(dllexport)
|
||||||
|
|
|
@ -620,13 +620,8 @@ namespace libtorrent
|
||||||
ret.resize(outsize);
|
ret.resize(outsize);
|
||||||
char const* in = s.c_str();
|
char const* in = s.c_str();
|
||||||
char* out = &ret[0];
|
char* out = &ret[0];
|
||||||
#ifdef TORRENT_LINUX
|
// posix has a weird iconv signature
|
||||||
// linux (and posix) seems to have a weird iconv signature
|
size_t retval = iconv(h, (char**)&in, &insize,
|
||||||
#define ICONV_IN_CAST (char**)
|
|
||||||
#else
|
|
||||||
#define ICONV_IN_CAST
|
|
||||||
#endif
|
|
||||||
size_t retval = iconv(h, ICONV_IN_CAST &in, &insize,
|
|
||||||
&out, &outsize);
|
&out, &outsize);
|
||||||
if (retval == (size_t)-1) return s;
|
if (retval == (size_t)-1) return s;
|
||||||
// if this string has an invalid utf-8 sequence in it, don't touch it
|
// if this string has an invalid utf-8 sequence in it, don't touch it
|
||||||
|
|
Loading…
Reference in New Issue