forked from pinard/Recode
-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use GNU libiconv instead of system iconv
- Loading branch information
Showing
13 changed files
with
78 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ jobs: | |
release: false | ||
msystem: ${{matrix.sys}} | ||
install: >- | ||
patch git groff help2man rsync texinfo flex | ||
patch git groff help2man rsync texinfo flex gperf | ||
mingw-w64-${{matrix.arch}}-autotools | ||
mingw-w64-${{matrix.arch}}-gcc | ||
mingw-w64-${{matrix.arch}}-python3 | ||
|
@@ -42,17 +42,18 @@ jobs: | |
submodules: true | ||
- name: Install dependencies (Ubuntu) | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
run: sudo apt-get -y install python3 cython3 flex help2man autopoint texinfo gettext | ||
run: sudo apt-get -y install python3 cython3 flex help2man autopoint texinfo gettext gperf groff | ||
- name: Install dependencies (macOS) | ||
if: ${{ matrix.os == 'macos-latest' }} | ||
run: | | ||
brew install libtool autoconf automake help2man [email protected] python-setuptools cython flex texinfo | ||
brew install libtool autoconf automake help2man [email protected] python-setuptools cython flex texinfo gperf groff gnu-tar | ||
# Prepend optional brew binary directories to PATH | ||
echo "$(brew --prefix)/opt/gnu-tar/libexec/gnubin:$(brew --prefix)/opt/flex/bin:$(brew --prefix)/opt/m4/bin:$(brew --prefix)/opt/texinfo/bin:$(brew --prefix)/opt/gettext/bin:$(brew --prefix)/opt/[email protected]/libexec/bin:$(brew --prefix)/opt/cython/bin" >> $GITHUB_PATH | ||
- name: Set up environment (Ubuntu) | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
# FIXME: ASAN | ||
run: | | ||
echo "ASAN=yes" >> $GITHUB_ENV | ||
echo "# ASAN=yes" >> $GITHUB_ENV | ||
echo "LSAN_OPTIONS=verbosity=1:log_threads=1" >> $GITHUB_ENV | ||
- name: Set up environment (macOS) | ||
if: ${{ matrix.os == 'macos-latest' }} | ||
|
@@ -67,6 +68,6 @@ jobs: | |
- name: Build | ||
run: | | ||
./bootstrap | ||
if [[ "$ASAN" == "yes" ]]; then ./configure --enable-silent-rules CFLAGS="-g3 -fsanitize=address -fsanitize=undefined" LDFLAGS="-fsanitize=address -fsanitize=undefined" TESTS_ENVIRONMENT_EXTRA="LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/11/libasan.so PYTHONMALLOC=malloc"; else ./configure --enable-silent-rules; fi | ||
if [[ "$ASAN" == "yes" ]]; then ./configure --enable-silent-rules CFLAGS="-g3 -fPIC -fsanitize=address -fsanitize=undefined" LDFLAGS="-fsanitize=address -fsanitize=undefined" TESTS_ENVIRONMENT_EXTRA="LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/11/libasan.so PYTHONMALLOC=malloc"; else ./configure --enable-silent-rules; fi | ||
make check | ||
make distcheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
./configure --disable-shared --enable-extra-encodings "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
AC_PREREQ([2.71]) | ||
AC_INIT([recode],[3.7.14],[[email protected]]) | ||
AC_CONFIG_SRCDIR(src/recode.c) | ||
AC_CONFIG_SUBDIRS([libiconv]) | ||
AC_CONFIG_AUX_DIR([build-aux]) | ||
AM_INIT_AUTOMAKE | ||
AC_CONFIG_MACRO_DIR(m4) | ||
|
@@ -110,8 +111,8 @@ AM_GNU_GETTEXT_VERSION(0.19) | |
AM_GNU_GETTEXT(external) | ||
AM_XGETTEXT_OPTION([--from-code=UTF-8]) | ||
|
||
# Output | ||
AC_CONFIG_HEADERS([config.h]) | ||
|
||
AC_CONFIG_FILES([Makefile contrib/Makefile doc/Makefile lib/Makefile | ||
po/Makefile.in src/Makefile src/recode.x | ||
tests/Makefile tests/setup.py]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../libiconv/include/iconv.h.inst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/usr/bin/python3 | ||
# -*- coding: utf-8 -*- | ||
# Automatically derive Recode table files from various sources. | ||
# Copyright © 1993-2000 Free Software Foundation, Inc. | ||
# Copyright © 1993-2023 Free Software Foundation, Inc. | ||
# François Pinard <[email protected]>, 1993. | ||
|
||
# This program is free software; you can redistribute it and/or modify | ||
|
@@ -40,7 +40,7 @@ | |
When `-F' and `-n' are used, process Alain's tables. | ||
""" | ||
|
||
import re, sys, io | ||
import re, sys, os, io | ||
|
||
# Character constants. | ||
REPLACEMENT_CHARACTER = 0xFFFD | ||
|
@@ -98,7 +98,6 @@ def main(self, *arguments): | |
|
||
# Read all data tables. | ||
if self.directory: | ||
import os | ||
os.chdir(self.directory) | ||
if self.iconv: | ||
self.iconv.digest() | ||
|
@@ -464,32 +463,22 @@ def digest(self): | |
canonical[charset.upper()] = charset | ||
|
||
# Read in the encodings.def file. | ||
sys.stdout.write("Reading from `iconv -l'\n") | ||
libc = None | ||
import os | ||
sys.stdout.write("Reading from `iconv_no_18n -l'\n") | ||
names = [] | ||
for line in os.popen('iconv -l'): | ||
if libc is None: | ||
libc = len(line.split('/')) == 3 | ||
if libc: | ||
first, second, empty = line.split('/') | ||
assert empty == '\n', repr(line) | ||
name = second or first | ||
if name not in names: | ||
names.append(name) | ||
self.data.append((name, ())) | ||
else: | ||
aliases = [] | ||
for alias in line.split(): | ||
if alias in canonical: | ||
alias = canonical[alias] | ||
aliases.append(alias) | ||
self.data.append((aliases[0], aliases[1:])) | ||
for line in os.popen('../libiconv/src/iconv_no_i18n -l'): | ||
aliases = [] | ||
for alias in line.split(): | ||
if alias in canonical: | ||
alias = canonical[alias] | ||
aliases.append(alias) | ||
self.data.append((aliases[0], aliases[1:])) | ||
|
||
def complete(self, french): | ||
def write_charset(format, charset): | ||
write(format % charset) | ||
write(format % (charset + "-translit")) | ||
def write_charset_with_aliases(charset, suffix=''): | ||
write(f' "{charset + suffix}",\n') | ||
for alias in aliases[:-1]: | ||
write(f'\t"{alias + suffix}",\n') | ||
write(f'\t"{aliases[-1] + suffix}", NULL,\n') | ||
if not self.do_sources: | ||
return | ||
write = Output(self.SOURCES).write | ||
|
@@ -505,12 +494,11 @@ def write_charset(format, charset): | |
% count) | ||
for charset, aliases in self.data: | ||
if aliases: | ||
write_charset(' "%s",\n', charset) | ||
for alias in aliases[:-1]: | ||
write_charset('\t"%s",\n', alias) | ||
write_charset('\t"%s", NULL,\n', aliases[-1]) | ||
write_charset_with_aliases(charset) | ||
write_charset_with_aliases(charset, '-translit') | ||
else: | ||
write_charset(' "%s", NULL,\n', charset) | ||
write(f' "{charset}", NULL,\n') | ||
write(f' "{charset}-translit", NULL,\n') | ||
write(' NULL\n' | ||
' };\n') | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters