Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .devcontainer
Submodule .devcontainer added at a9d469
30 changes: 30 additions & 0 deletions .github/workflows/xpbuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
workflow_dispatch:
jobs:
linux:
uses: externpro/externpro/.github/workflows/build-linux.yml@25.05.1
with:
cmake-workflow-preset: LinuxRelease
runon: ubuntu-latest
secrets: inherit
linux-arm64:
uses: externpro/externpro/.github/workflows/build-linux.yml@25.05.1
with:
cmake-workflow-preset: LinuxRelease
runon: ubuntu-24.04-arm
secrets: inherit
macos:
uses: externpro/externpro/.github/workflows/build-macos.yml@25.05.1
with:
cmake-workflow-preset: DarwinRelease
secrets: inherit
windows:
uses: externpro/externpro/.github/workflows/build-windows.yml@25.05.1
with:
cmake-workflow-preset: WindowsRelease
secrets: inherit
20 changes: 20 additions & 0 deletions .github/workflows/xprelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release
on:
workflow_dispatch:
inputs:
workflow_run_url:
description: 'URL of the workflow run containing artifacts to upload (e.g., https://github.com/owner/repo/actions/runs/123456789)'
required: true
type: string
jobs:
# Upload build artifacts as release assets
release-from-build:
uses: externpro/externpro/.github/workflows/release-from-build.yml@25.05.1
with:
workflow_run_url: ${{ github.event.inputs.workflow_run_url }}
artifact_pattern: "*.tar.xz"
permissions:
contents: write
id-token: write
attestations: write
secrets: inherit
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.env
_bld*/
docker-compose.override.yml
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule ".devcontainer"]
path = .devcontainer
url = https://github.com/externpro/externpro
Binary file added ARM64/Debug/libiconvD.dll
Binary file not shown.
Binary file added ARM64/Debug/libiconvD.exp
Binary file not shown.
Binary file added ARM64/Debug/libiconvD.lib
Binary file not shown.
Binary file added ARM64/Debug/libiconvD.pdb
Binary file not shown.
Binary file added ARM64/DebugStatic/libiconvStaticD.lib
Binary file not shown.
Binary file added ARM64/DebugStatic/libiconvStaticD.pdb
Binary file not shown.
Binary file added ARM64/Release/libiconv.dll
Binary file not shown.
Binary file added ARM64/Release/libiconv.exp
Binary file not shown.
Binary file added ARM64/Release/libiconv.lib
Binary file not shown.
Binary file added ARM64/Release/libiconv.pdb
Binary file not shown.
Binary file added ARM64/ReleaseStatic/libiconvStatic.lib
Binary file not shown.
47 changes: 47 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
cmake_minimum_required(VERSION 3.31)
set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES .devcontainer/cmake/xproinc.cmake)
project(libiconv VERSION 1.18)
include(GNUInstallDirs)
include(xpflags)
set(XP_INSTALL_CMAKEDIR ${CMAKE_INSTALL_DATADIR}/cmake)
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME devel)
set(libName xpro::${PROJECT_NAME})
if(WIN32)
install(FILES iconv.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES x64/ReleaseStatic/libiconvStatic.lib DESTINATION ${CMAKE_INSTALL_LIBDIR})
file(GLOB dbgFiles x64/DebugStatic/libiconvStaticD.*)
install(FILES ${dbgFiles} DESTINATION ${CMAKE_INSTALL_LIBDIR})
string(JOIN "\n" EXT1
"get_filename_component(PKG_ROOTDIR \${CMAKE_CURRENT_LIST_DIR}/../.. ABSOLUTE)"
"get_filename_component(PKG_ROOTDIR \${PKG_ROOTDIR} ABSOLUTE) # remove relative parts"
""
)
string(JOIN "\n" EXT2
"if(NOT TARGET ${libName})"
" add_library(${libName} STATIC IMPORTED)"
" set(libRelease \${PKG_ROOTDIR}/${CMAKE_INSTALL_LIBDIR}/libiconvStatic${CMAKE_STATIC_LIBRARY_SUFFIX})"
" set(libDebug \${PKG_ROOTDIR}/${CMAKE_INSTALL_LIBDIR}/libiconvStaticD${CMAKE_STATIC_LIBRARY_SUFFIX})"
" if(EXISTS \"\${libRelease}\" AND EXISTS \"\${libDebug}\")"
" set_property(TARGET ${libName} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG)"
" set_target_properties(${libName} PROPERTIES"
" IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE \"C\""
" IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG \"C\""
" IMPORTED_LOCATION_RELEASE \"\${libRelease}\""
" IMPORTED_LOCATION_DEBUG \"\${libDebug}\""
" INTERFACE_INCLUDE_DIRECTORIES \"\${PKG_ROOTDIR}/${CMAKE_INSTALL_INCLUDEDIR}\""
" )"
" endif()"
"endif()"
""
)
else()
string(JOIN "\n" EXT2
"if(NOT TARGET ${libName})"
" add_library(${libName} INTERFACE IMPORTED)"
" find_package(Iconv REQUIRED)"
" target_link_libraries(${libName} INTERFACE Iconv::Iconv)"
"endif()"
""
)
endif()
xpPackageDevel()
8 changes: 8 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"version": 8,
"include": [
".devcontainer/cmake/presets/xpLinuxNinja.json",
".devcontainer/cmake/presets/xpDarwinNinja.json",
".devcontainer/cmake/presets/xpWindowsVs2022.json"
]
}
10 changes: 10 additions & 0 deletions CMakePresetsBase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version": 8,
"configurePresets": [
{
"name": "config-base",
"hidden": true,
"binaryDir": "${sourceDir}/_bld-${presetName}"
}
]
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# libiconv
* https://www.gnu.org/software/libiconv/
* https://savannah.gnu.org/projects/libiconv/
* https://github.com/pffang/libiconv-for-Windows
Binary file added Win32/Debug/libiconvD.dll
Binary file not shown.
Binary file added Win32/Debug/libiconvD.exp
Binary file not shown.
Binary file added Win32/Debug/libiconvD.lib
Binary file not shown.
Binary file added Win32/Debug/libiconvD.pdb
Binary file not shown.
Binary file added Win32/DebugStatic/libiconvStaticD.idb
Binary file not shown.
Binary file added Win32/DebugStatic/libiconvStaticD.lib
Binary file not shown.
Binary file added Win32/DebugStatic/libiconvStaticD.pdb
Binary file not shown.
Binary file added Win32/Release/libiconv.dll
Binary file not shown.
Binary file added Win32/Release/libiconv.exp
Binary file not shown.
Binary file added Win32/Release/libiconv.lib
Binary file not shown.
Binary file added Win32/Release/libiconv.pdb
Binary file not shown.
Binary file added Win32/ReleaseStatic/libiconvStatic.lib
Binary file not shown.
1 change: 1 addition & 0 deletions docker-compose.sh
1 change: 1 addition & 0 deletions docker-compose.yml
254 changes: 254 additions & 0 deletions iconv.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,254 @@
/* Copyright (C) 1999-2024 Free Software Foundation, Inc.
This file is part of the GNU LIBICONV Library.

The GNU LIBICONV Library is free software; you can redistribute it
and/or modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either version 2.1
of the License, or (at your option) any later version.

The GNU LIBICONV Library is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with the GNU LIBICONV Library; see the file COPYING.LIB.
If not, see <https://www.gnu.org/licenses/>. */

/* When installed, this file is called "iconv.h". */

#ifndef _LIBICONV_H
#define _LIBICONV_H

#ifdef __cplusplus
extern "C" {
#endif

#define _LIBICONV_VERSION 0x0111 /* version number: (major<<8) + minor */
extern __declspec (dllimport) int _libiconv_version; /* Likewise */

#ifdef __cplusplus
}
#endif

/* 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().) */

/* Define iconv_t ourselves. */
#undef iconv_t
#define iconv_t libiconv_t
typedef void* iconv_t;

/* Get size_t declaration.
Get wchar_t declaration if it exists. */
#include <stddef.h>

/* Get errno declaration and values. */
#include <errno.h>
/* Some systems, like SunOS 4, don't have EILSEQ. Some systems, like BSD/OS,
have EILSEQ in a different header. On these systems, define EILSEQ
ourselves. */
#ifndef EILSEQ
#define EILSEQ
#endif


#ifdef __cplusplus
extern "C" {
#endif


/* Allocates descriptor for code conversion from encoding ‘fromcode’ to
encoding ‘tocode’. */
#ifndef LIBICONV_PLUG
#define iconv_open libiconv_open
#endif
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
‘*outbuf’.
Decrements ‘*inbytesleft’ and increments ‘*inbuf’ by the same amount.
Decrements ‘*outbytesleft’ and increments ‘*outbuf’ by the same amount. */
#ifndef LIBICONV_PLUG
#define iconv libiconv
#endif
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 int iconv_close (iconv_t cd);


#ifdef __cplusplus
}
#endif


#ifndef LIBICONV_PLUG

/* Nonstandard extensions. */

#if 1
#if 0
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
<wchar.h>.
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
included before <wchar.h>. */
#include <stddef.h>
#include <stdio.h>
#include <time.h>
#endif
#include <wchar.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif

/* A type that holds all memory needed by a conversion descriptor.
A pointer to such an object can be used as an iconv_t. */
typedef struct {
void* dummy1[28];
#if 1
mbstate_t dummy2;
#endif
} iconv_allocation_t;

/* Allocates descriptor for code conversion from encoding ‘fromcode’ to
encoding ‘tocode’ into preallocated memory. Returns an error indicator
(0 or -1 with errno set). */
#define iconv_open_into libiconv_open_into
extern int iconv_open_into (const char* tocode, const char* fromcode,
iconv_allocation_t* resultp);

/* Control of attributes. */
#define iconvctl libiconvctl
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);
/* Hook performed after every successful conversion of a wide character. */
typedef void (*iconv_wide_char_hook) (wchar_t wc, void* data);
/* Set of hooks. */
struct iconv_hooks {
iconv_unicode_char_hook uc_hook;
iconv_wide_char_hook wc_hook;
void* data;
};

/* Fallback function. Invoked when a small number of bytes could not be
converted to a Unicode character. This function should process all
bytes from inbuf and may produce replacement Unicode characters by calling
the write_replacement callback repeatedly. */
typedef void (*iconv_unicode_mb_to_uc_fallback)
(const char* inbuf, size_t inbufsize,
void (*write_replacement) (const unsigned int *buf, size_t buflen,
void* callback_arg),
void* callback_arg,
void* data);
/* Fallback function. Invoked when a Unicode character could not be converted
to the target encoding. This function should process the character and
may produce replacement bytes (in the target encoding) by calling the
write_replacement callback repeatedly. */
typedef void (*iconv_unicode_uc_to_mb_fallback)
(unsigned int code,
void (*write_replacement) (const char *buf, size_t buflen,
void* callback_arg),
void* callback_arg,
void* data);
/* 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
callback repeatedly. */
typedef void (*iconv_wchar_mb_to_wc_fallback)
(const char* inbuf, size_t inbufsize,
void (*write_replacement) (const wchar_t *buf, size_t buflen,
void* callback_arg),
void* callback_arg,
void* data);
/* Fallback function. Invoked when a wide character could not be converted to
the target encoding. This function should process the character and may
produce replacement bytes (in the target encoding) by calling the
write_replacement callback repeatedly. */
typedef void (*iconv_wchar_wc_to_mb_fallback)
(wchar_t code,
void (*write_replacement) (const char *buf, size_t buflen,
void* callback_arg),
void* callback_arg,
void* data);
/* Set of fallbacks. */
struct iconv_fallbacks {
iconv_unicode_mb_to_uc_fallback mb_to_uc_fallback;
iconv_unicode_uc_to_mb_fallback uc_to_mb_fallback;
iconv_wchar_mb_to_wc_fallback mb_to_wc_fallback;
iconv_wchar_wc_to_mb_fallback wc_to_mb_fallback;
void* data;
};

/* Surfaces.
The concept of surfaces is described in the 'recode' manual. */
#define ICONV_SURFACE_NONE 0
/* In EBCDIC encodings, 0x15 (which encodes the "newline function", see the
Unicode standard, chapter 5) maps to U+000A instead of U+0085. This is
for interoperability with C programs and Unix environments on z/OS. */
#define ICONV_SURFACE_EBCDIC_ZOS_UNIX 1

/* Requests for iconvctl. */
#define ICONV_TRIVIALP 0 /* int *argument */
#define ICONV_GET_TRANSLITERATE 1 /* int *argument */
#define ICONV_SET_TRANSLITERATE 2 /* const int *argument */
#define ICONV_GET_DISCARD_ILSEQ 3 /* int *argument */
#define ICONV_SET_DISCARD_ILSEQ 4 /* const int *argument */
#define ICONV_SET_HOOKS 5 /* const struct iconv_hooks *argument */
#define ICONV_SET_FALLBACKS 6 /* const struct iconv_fallbacks *argument */
#define ICONV_GET_FROM_SURFACE 7 /* unsigned int *argument */
#define ICONV_SET_FROM_SURFACE 8 /* const unsigned int *argument */
#define ICONV_GET_TO_SURFACE 9 /* unsigned int *argument */
#define ICONV_SET_TO_SURFACE 10 /* const unsigned int *argument */

/* Listing of locale independent encodings. */
#define iconvlist libiconvlist
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 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 void libiconv_set_relocation_prefix (const char *orig_prefix,
const char *curr_prefix);

#ifdef __cplusplus
}
#endif

#endif


#endif /* _LIBICONV_H */
Binary file added x64/Debug/libiconvD.dll
Binary file not shown.
Binary file added x64/Debug/libiconvD.exp
Binary file not shown.
Binary file added x64/Debug/libiconvD.lib
Binary file not shown.
Binary file added x64/Debug/libiconvD.pdb
Binary file not shown.
Binary file added x64/DebugStatic/libiconvStaticD.idb
Binary file not shown.
Binary file added x64/DebugStatic/libiconvStaticD.lib
Binary file not shown.
Binary file added x64/DebugStatic/libiconvStaticD.pdb
Binary file not shown.
Binary file added x64/Release/libiconv.dll
Binary file not shown.
Binary file added x64/Release/libiconv.exp
Binary file not shown.
Binary file added x64/Release/libiconv.lib
Binary file not shown.
Binary file added x64/Release/libiconv.pdb
Binary file not shown.
Binary file added x64/ReleaseStatic/libiconvStatic.lib
Binary file not shown.