mirror of
https://review.haiku-os.org/haiku
synced 2024-11-23 15:28:58 +01:00
worked standalone libiconv into a working state that is compatible with
the libiconv that was available for R5 * cleaned up iconv.h * moved public libiconv headers (iconv.h and localcharset.h) into a specific folder in headers/libs * renamed config.h to libiconv_config.h in order to circumvent strange problems with regex.c from glibc picking it up git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28630 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
aef5731f38
commit
01025e2856
@ -22,30 +22,7 @@
|
||||
#define _LIBICONV_H
|
||||
|
||||
#define _LIBICONV_VERSION 0x010B /* version number: (major<<8) + minor */
|
||||
|
||||
#if 0 && BUILDING_LIBICONV
|
||||
#define LIBICONV_DLL_EXPORTED __attribute__((__visibility__("default")))
|
||||
#else
|
||||
#define LIBICONV_DLL_EXPORTED
|
||||
#endif
|
||||
extern LIBICONV_DLL_EXPORTED int _libiconv_version; /* Likewise */
|
||||
|
||||
/* We would like to #include any system header file which could define
|
||||
iconv_t, 1. in order to eliminate the risk that the user gets compilation
|
||||
errors because some other system header file includes /usr/include/iconv.h
|
||||
which defines iconv_t or declares iconv after this file, 2. when compiling
|
||||
for LIBICONV_PLUG, we need the proper iconv_t type in order to produce
|
||||
binary compatible code.
|
||||
But gcc's #include_next is not portable. Thus, once libiconv's iconv.h
|
||||
has been installed in /usr/local/include, there is no way any more to
|
||||
include the original /usr/include/iconv.h. We simply have to get away
|
||||
without it.
|
||||
Ad 1. The risk that a system header file does
|
||||
#include "iconv.h" or #include_next "iconv.h"
|
||||
is small. They all do #include <iconv.h>.
|
||||
Ad 2. The iconv_t type is a pointer type in all cases I have seen. (It
|
||||
has to be a scalar type because (iconv_t)(-1) is a possible return value
|
||||
from iconv_open().) */
|
||||
extern int _libiconv_version; /* Likewise */
|
||||
|
||||
/* Define iconv_t ourselves. */
|
||||
#undef iconv_t
|
||||
@ -76,7 +53,7 @@ extern "C" {
|
||||
#ifndef LIBICONV_PLUG
|
||||
#define iconv_open libiconv_open
|
||||
#endif
|
||||
extern LIBICONV_DLL_EXPORTED iconv_t iconv_open (const char* tocode, const char* fromcode);
|
||||
extern iconv_t iconv_open(const char* tocode, const char* fromcode);
|
||||
|
||||
/* Converts, using conversion descriptor `cd', at most `*inbytesleft' bytes
|
||||
starting at `*inbuf', writing at most `*outbytesleft' bytes starting at
|
||||
@ -86,13 +63,14 @@ extern LIBICONV_DLL_EXPORTED iconv_t iconv_open (const char* tocode, const char*
|
||||
#ifndef LIBICONV_PLUG
|
||||
#define iconv libiconv
|
||||
#endif
|
||||
extern LIBICONV_DLL_EXPORTED size_t iconv (iconv_t cd, char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
|
||||
extern size_t iconv(iconv_t cd, char* * inbuf, size_t *inbytesleft,
|
||||
char* * outbuf, size_t *outbytesleft);
|
||||
|
||||
/* Frees resources allocated for conversion descriptor `cd'. */
|
||||
#ifndef LIBICONV_PLUG
|
||||
#define iconv_close libiconv_close
|
||||
#endif
|
||||
extern LIBICONV_DLL_EXPORTED int iconv_close (iconv_t cd);
|
||||
extern int iconv_close(iconv_t cd);
|
||||
|
||||
|
||||
#ifndef LIBICONV_PLUG
|
||||
@ -101,7 +79,7 @@ extern LIBICONV_DLL_EXPORTED int iconv_close (iconv_t cd);
|
||||
|
||||
/* Control of attributes. */
|
||||
#define iconvctl libiconvctl
|
||||
extern LIBICONV_DLL_EXPORTED int iconvctl (iconv_t cd, int request, void* argument);
|
||||
extern int iconvctl(iconv_t cd, int request, void* argument);
|
||||
|
||||
/* Hook performed after every successful conversion of a Unicode character. */
|
||||
typedef void (*iconv_unicode_char_hook) (unsigned int uc, void* data);
|
||||
@ -134,7 +112,7 @@ typedef void (*iconv_unicode_uc_to_mb_fallback)
|
||||
void* callback_arg),
|
||||
void* callback_arg,
|
||||
void* data);
|
||||
#if 1
|
||||
#if HAVE_WCHAR_T
|
||||
/* Fallback function. Invoked when a number of bytes could not be converted to
|
||||
a wide character. This function should process all bytes from inbuf and may
|
||||
produce replacement wide characters by calling the write_replacement
|
||||
@ -181,24 +159,14 @@ struct iconv_fallbacks {
|
||||
|
||||
/* Listing of locale independent encodings. */
|
||||
#define iconvlist libiconvlist
|
||||
extern LIBICONV_DLL_EXPORTED void iconvlist (int (*do_one) (unsigned int namescount,
|
||||
const char * const * names,
|
||||
void* data),
|
||||
void* data);
|
||||
extern void iconvlist(int (*do_one)(unsigned int namescount,
|
||||
const char * const * names,
|
||||
void* data),
|
||||
void* data);
|
||||
|
||||
/* Canonicalize an encoding name.
|
||||
The result is either a canonical encoding name, or name itself. */
|
||||
extern LIBICONV_DLL_EXPORTED const char * iconv_canonicalize (const char * name);
|
||||
|
||||
/* Support for relocatable packages. */
|
||||
|
||||
/* Sets the original and the current installation prefix of the package.
|
||||
Relocation simply replaces a pathname starting with the original prefix
|
||||
by the corresponding pathname with the current prefix instead. Both
|
||||
prefixes should be directory names without trailing slash (i.e. use ""
|
||||
instead of "/"). */
|
||||
extern LIBICONV_DLL_EXPORTED void libiconv_set_relocation_prefix (const char *orig_prefix,
|
||||
const char *curr_prefix);
|
||||
extern const char * iconv_canonicalize(const char * name);
|
||||
|
||||
#endif
|
||||
|
@ -20,12 +20,6 @@
|
||||
#ifndef _LOCALCHARSET_H
|
||||
#define _LOCALCHARSET_H
|
||||
|
||||
#if 0 && BUILDING_LIBCHARSET
|
||||
#define LIBCHARSET_DLL_EXPORTED __attribute__((__visibility__("default")))
|
||||
#else
|
||||
#define LIBCHARSET_DLL_EXPORTED
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -37,7 +31,7 @@ extern "C" {
|
||||
The result must not be freed; it is statically allocated.
|
||||
If the canonical name cannot be determined, the result is a non-canonical
|
||||
name. */
|
||||
extern LIBCHARSET_DLL_EXPORTED const char * locale_charset (void);
|
||||
extern const char* locale_charset(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
20
src/libs/iconv/Jamfile
Normal file
20
src/libs/iconv/Jamfile
Normal file
@ -0,0 +1,20 @@
|
||||
SubDir HAIKU_TOP src libs iconv ;
|
||||
|
||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||
AddSubDirSupportedPlatforms libbe_test ;
|
||||
|
||||
UseLibraryHeaders iconv ;
|
||||
|
||||
# disable warnings we don't want here
|
||||
TARGET_WARNING_CCFLAGS = [ FFilter $(TARGET_WARNING_CCFLAGS)
|
||||
: -Wmissing-prototypes -Wsign-compare ] ;
|
||||
|
||||
SubDirCcFlags
|
||||
-DLIBDIR="\\\"/boot/beos/system/lib\\\""
|
||||
-DICONV_CONST=""
|
||||
;
|
||||
|
||||
SharedLibrary libiconv.so :
|
||||
iconv.c
|
||||
localcharset.c
|
||||
;
|
@ -1,160 +0,0 @@
|
||||
# Makefile for libiconv/lib
|
||||
|
||||
#### Start of system configuration section. ####
|
||||
|
||||
# Directories used by "make":
|
||||
srcdir = @srcdir@
|
||||
|
||||
# Directories used by "make install":
|
||||
prefix = @prefix@
|
||||
local_prefix = /usr/local
|
||||
exec_prefix = @exec_prefix@
|
||||
libdir = @libdir@
|
||||
|
||||
# Programs used by "make":
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@ @CFLAG_VISIBILITY@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@ $(LDFLAGS_@WOE32DLL@)
|
||||
LDFLAGS_yes = -Wl,--export-all-symbols
|
||||
LDFLAGS_no =
|
||||
INCLUDES = -I. -I$(srcdir) -I../include -I$(srcdir)/../include -I.. -I$(srcdir)/..
|
||||
# -DBUILDING_LIBICONV: Change expansion of LIBICONV_DLL_EXPORTED macro.
|
||||
# -DBUILDING_DLL: Change expansion of RELOCATABLE_DLL_EXPORTED macro.
|
||||
DEFS = -DLIBDIR=\"$(libdir)\" -DBUILDING_LIBICONV -DBUILDING_DLL \
|
||||
-DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"$(libdir)\" -DNO_XMALLOC \
|
||||
-Dset_relocation_prefix=libiconv_set_relocation_prefix \
|
||||
-Drelocate=libiconv_relocate @DEFS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile
|
||||
LIBTOOL_LINK = $(LIBTOOL) --mode=link
|
||||
LIBTOOL_INSTALL = $(LIBTOOL) --mode=install
|
||||
LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall
|
||||
WINDRES = @WINDRES@
|
||||
CP = cp
|
||||
MV = mv
|
||||
LN = @LN@
|
||||
LN_S = @LN_S@
|
||||
RM = rm -f
|
||||
|
||||
# Programs used by "make install":
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
mkinstalldirs = $(SHELL) @top_srcdir@/build-aux/mkinstalldirs
|
||||
|
||||
#### End of system configuration section. ####
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
# Before making a release, change this according to the libtool documentation,
|
||||
# section "Library interface versions".
|
||||
LIBICONV_VERSION_INFO = 6:0:4
|
||||
|
||||
PACKAGE_VERSION = @VERSION@
|
||||
|
||||
# Needed by $(LIBTOOL).
|
||||
top_builddir = ..
|
||||
|
||||
SOURCES = $(srcdir)/iconv.c $(srcdir)/../libcharset/lib/localcharset.c $(srcdir)/relocatable.c
|
||||
|
||||
OBJECTS = iconv.lo localcharset.lo relocatable.lo $(OBJECTS_EXP_@WOE32DLL@) $(OBJECTS_RES_@WOE32@)
|
||||
OBJECTS_EXP_yes = iconv-exports.lo
|
||||
OBJECTS_EXP_no =
|
||||
OBJECTS_RES_yes = libiconv.res
|
||||
OBJECTS_RES_no =
|
||||
|
||||
all : @PLUGLIB@ libiconv.la
|
||||
|
||||
libiconv.la : $(OBJECTS)
|
||||
$(LIBTOOL_LINK) $(CC) $(LDFLAGS) $(CFLAGS) -o libiconv.la -rpath $(libdir) -version-info $(LIBICONV_VERSION_INFO) -no-undefined $(OBJECTS)
|
||||
|
||||
preloadable_libiconv.so : preloadable_libiconv_@OS@.so
|
||||
$(RM) preloadable_libiconv.so
|
||||
$(LN_S) preloadable_libiconv_@OS@.so preloadable_libiconv.so
|
||||
|
||||
preloadable_libiconv_linux.so : $(SOURCES)
|
||||
if test -n "@GCC@"; then \
|
||||
$(LIBTOOL_LINK) $(CC) $(LDFLAGS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) $(DEFS) -fPIC -DPIC -DLIBICONV_PLUG $(SOURCES) -shared -o preloadable_libiconv_linux.so; \
|
||||
else \
|
||||
$(LIBTOOL_LINK) $(CC) $(LDFLAGS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) $(DEFS) -KPIC -DPIC -DLIBICONV_PLUG $(SOURCES) -shared -o preloadable_libiconv_linux.so; \
|
||||
fi
|
||||
|
||||
preloadable_libiconv_solaris.so : $(SOURCES)
|
||||
if test -n "@GCC@"; then \
|
||||
$(LIBTOOL_LINK) $(CC) $(LDFLAGS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) $(DEFS) -fPIC -DPIC -DLIBICONV_PLUG $(SOURCES) -shared -o preloadable_libiconv_solaris.so; \
|
||||
else \
|
||||
$(LIBTOOL_LINK) $(CC) $(LDFLAGS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) $(DEFS) -KPIC -DPIC -DLIBICONV_PLUG $(SOURCES) -G -o preloadable_libiconv_solaris.so; \
|
||||
fi
|
||||
|
||||
preloadable_libiconv_osf.so : $(SOURCES)
|
||||
if test -n "@GCC@"; then \
|
||||
$(LIBTOOL_LINK) $(CC) $(LDFLAGS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) $(DEFS) -fPIC -DPIC -DLIBICONV_PLUG $(SOURCES) -shared -o preloadable_libiconv_osf.so; \
|
||||
else \
|
||||
mkdir objects; \
|
||||
for f in $(SOURCES); do \
|
||||
$(CC) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) $(DEFS) -DPIC -DLIBICONV_PLUG -c $$f -o objects/`basename $$f | sed -e 's,\.c$$,.o,'`; \
|
||||
done; \
|
||||
/bin/ld -shared -expect_unresolved \* -o preloadable_libiconv_osf.so objects/*.o; \
|
||||
rm -rf objects; \
|
||||
fi
|
||||
|
||||
iconv.lo : $(srcdir)/iconv.c $(srcdir)/converters.h $(srcdir)/encodings.def $(srcdir)/encodings_aix.def $(srcdir)/encodings_osf1.def $(srcdir)/encodings_dos.def $(srcdir)/encodings_local.def $(srcdir)/aliases.h $(srcdir)/aliases_aix.h $(srcdir)/aliases_osf1.h $(srcdir)/aliases_dos.h $(srcdir)/flags.h
|
||||
$(LIBTOOL_COMPILE) $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(DEFS) -c $(srcdir)/iconv.c
|
||||
|
||||
localcharset.lo : $(srcdir)/../libcharset/lib/localcharset.c $(srcdir)/relocatable.h
|
||||
$(LIBTOOL_COMPILE) $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(DEFS) -c $(srcdir)/../libcharset/lib/localcharset.c
|
||||
|
||||
relocatable.lo : $(srcdir)/relocatable.c $(srcdir)/relocatable.h
|
||||
$(LIBTOOL_COMPILE) $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(DEFS) -c $(srcdir)/relocatable.c
|
||||
|
||||
iconv-exports.lo : $(srcdir)/../woe32dll/iconv-exports.c
|
||||
$(LIBTOOL_COMPILE) $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(DEFS) -c $(srcdir)/../woe32dll/iconv-exports.c
|
||||
|
||||
libiconv.res : $(srcdir)/../windows/libiconv.rc
|
||||
$(WINDRES) `$(SHELL) $(srcdir)/../windows/windres-options --escape $(PACKAGE_VERSION)` -i $(srcdir)/../windows/libiconv.rc -o libiconv.res --output-format=coff
|
||||
|
||||
# Installs the library and include files only. Typically called with only
|
||||
# $(libdir) and $(includedir) - don't use $(prefix) and $(exec_prefix) here.
|
||||
install-lib : all force
|
||||
if [ ! -d $(libdir) ] ; then $(mkinstalldirs) $(libdir) ; fi
|
||||
$(LIBTOOL_INSTALL) $(INSTALL_DATA) libiconv.la $(libdir)/libiconv.la
|
||||
|
||||
# On AIX, libiconv.a must include the object files of /lib/libiconv.a,
|
||||
# otherwise the setlocale() call fails when invoked from executables linked
|
||||
# with -rpath $(libdir), even if linked without -liconv.
|
||||
install : all force
|
||||
if [ ! -d $(DESTDIR)$(libdir) ] ; then $(mkinstalldirs) $(DESTDIR)$(libdir) ; fi
|
||||
$(LIBTOOL_INSTALL) $(INSTALL_DATA) libiconv.la $(DESTDIR)$(libdir)/libiconv.la
|
||||
case "@host_os@" in \
|
||||
aix*) (cd $(DESTDIR)$(libdir) && \
|
||||
objects=`ar t libiconv.a`" "`ar t /lib/libiconv.a` && \
|
||||
ar x libiconv.a && ar x /lib/libiconv.a && \
|
||||
ar q libiconv.new.a $$objects && \
|
||||
rm -f $$objects && \
|
||||
mv -f libiconv.new.a libiconv.a) ;; \
|
||||
esac
|
||||
if test -n "@PLUGLIB@"; then $(INSTALL_DATA) @PLUGLIB@ $(DESTDIR)$(libdir)/@PLUGLIB@.new && mv $(DESTDIR)$(libdir)/@PLUGLIB@.new $(DESTDIR)$(libdir)/@PLUGLIB@ ; fi
|
||||
|
||||
installdirs : force
|
||||
if [ ! -d $(DESTDIR)$(libdir) ] ; then $(mkinstalldirs) $(DESTDIR)$(libdir) ; fi
|
||||
|
||||
uninstall : force
|
||||
$(LIBTOOL_UNINSTALL) $(RM) $(DESTDIR)$(libdir)/libiconv.la
|
||||
if test -n "@PLUGLIB@"; then $(RM) $(DESTDIR)$(libdir)/@PLUGLIB@ ; fi
|
||||
|
||||
check : all
|
||||
|
||||
mostlyclean : clean
|
||||
|
||||
clean : force
|
||||
$(RM) *.o *.lo libiconv.res *.a *.la preloadable_libiconv* core *.stackdump so_locations
|
||||
$(RM) -r .libs _libs
|
||||
|
||||
distclean : clean
|
||||
$(RM) Makefile config.h libtool
|
||||
|
||||
maintainer-clean : distclean
|
||||
|
||||
force :
|
||||
|
@ -18,11 +18,11 @@
|
||||
* Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <iconv.h>
|
||||
#include "iconv.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "config.h"
|
||||
#include "libiconv_config.h"
|
||||
#include "localcharset.h"
|
||||
|
||||
#if ENABLE_EXTRA
|
||||
|
@ -35,7 +35,7 @@
|
||||
/* #undef ENABLE_NLS */
|
||||
|
||||
/* Define to 1 if the package shall run at any location in the filesystem. */
|
||||
#define ENABLE_RELOCATABLE 1
|
||||
/* #undef ENABLE_RELOCATABLE */
|
||||
|
||||
/* Define to 1 if you have `alloca', as a function or macro. */
|
||||
#define HAVE_ALLOCA 1
|
||||
@ -318,7 +318,7 @@
|
||||
/* Define to 1 if you want getc etc. to use unlocked I/O if available.
|
||||
Unlocked I/O can improve performance in unithreaded apps, but it is not
|
||||
safe for multithreaded apps. */
|
||||
#define USE_UNLOCKED_IO 1
|
||||
/* #undef USE_UNLOCKED_IO */
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "1.12"
|
@ -19,7 +19,7 @@
|
||||
|
||||
/* Written by Bruno Haible <bruno@clisp.org>. */
|
||||
|
||||
#include <config.h>
|
||||
#include "libiconv_config.h"
|
||||
|
||||
/* Specification. */
|
||||
#include "localcharset.h"
|
||||
|
Loading…
Reference in New Issue
Block a user