allow UTF-8 support to be toggled

This commit is contained in:
speedie 2023-05-11 16:46:32 +02:00
parent cf0e2272cd
commit ee7419704d
5 changed files with 17 additions and 0 deletions

View file

@ -42,6 +42,7 @@ build() {
-Dpangoxft="$pangoxft" \ -Dpangoxft="$pangoxft" \
-Dlibconfig="$libconfig" \ -Dlibconfig="$libconfig" \
-Dopt="$opt" \ -Dopt="$opt" \
-Dutf8="$utf8" \
build build
else else
meson setup \ meson setup \
@ -54,6 +55,7 @@ build() {
-Dpangoxft="$pangoxft" \ -Dpangoxft="$pangoxft" \
-Dlibconfig="$libconfig" \ -Dlibconfig="$libconfig" \
-Dopt="$opt" \ -Dopt="$opt" \
-Dutf8="$utf8" \
build build
fi fi

View file

@ -12,6 +12,7 @@ openssl=true # enable support for openssl, used to calculate MD5
fribidi=true # enable support for right to left languages fribidi=true # enable support for right to left languages
libconfig=true # enable configuration and themes libconfig=true # enable configuration and themes
xresources=true # enable .Xresources support xresources=true # enable .Xresources support
utf8=true # enable UTF-8 support
opt=-O2 # level of optimization opt=-O2 # level of optimization
warn=true # warn about OS quirks warn=true # warn about OS quirks
install=true # automatically install, if set to false an install will not be performed install=true # automatically install, if set to false an install will not be performed

View file

@ -9,6 +9,11 @@
#define USEPANGO 0 #define USEPANGO 0
#else #else
#define USEPANGO 1 #define USEPANGO 1
#ifndef UTF8
#define USEUTF8 0
#else
#define USEUTF8 1
#endif
#endif #endif
#if USEPANGO #if USEPANGO
@ -318,7 +323,11 @@ char *parse_utf(char *str, size_t clen) {
char *cstr = cnstr; char *cstr = cnstr;
size_t olen = clen; size_t olen = clen;
#if USEUTF8
iconv_t cd = iconv_open("UTF-8//IGNORE", "UTF-8");
#else
iconv_t cd = iconv_open("UTF-8//IGNORE", "ASCII"); iconv_t cd = iconv_open("UTF-8//IGNORE", "ASCII");
#endif
if (cd == (iconv_t) - 1) { if (cd == (iconv_t) - 1) {
die("spmenu: iconv_open failed"); die("spmenu: iconv_open failed");

View file

@ -71,6 +71,10 @@ if get_option('xresources')
build_args += [ '-DXRESOURCES' ] build_args += [ '-DXRESOURCES' ]
endif endif
if get_option('utf8')
build_args += [ '-DUTF8' ]
endif
project_target = executable( project_target = executable(
meson.project_name(), meson.project_name(),
project_source_files, install : true, project_source_files, install : true,

View file

@ -6,4 +6,5 @@ option('libconfig', type : 'boolean', value : true, description : 'Enable config
option('pango', type : 'boolean', value : true, description : 'Enable Pango markup support') option('pango', type : 'boolean', value : true, description : 'Enable Pango markup support')
option('pangoxft', type : 'boolean', value : true, description : 'Enable Pango for libXft') option('pangoxft', type : 'boolean', value : true, description : 'Enable Pango for libXft')
option('xinerama', type : 'boolean', value : true, description : 'Enable multi-monitor support using libXinerama') option('xinerama', type : 'boolean', value : true, description : 'Enable multi-monitor support using libXinerama')
option('utf8', type : 'boolean', value : true, description : 'Enable UTF-8 character support')
option('opt', type : 'string', value : '-O2', description : 'Optimization level') option('opt', type : 'string', value : '-O2', description : 'Optimization level')