Skip to content

Commit fdfa7f6

Browse files
committed
Merge branch 'ps/ci-gitlab-prepare-for-macos-14-deprecation'
Move gitlab CI from macOS 14 images that are being deprecated. * ps/ci-gitlab-prepare-for-macos-14-deprecation: gitlab-ci: update to macOS 15 images meson: detect broken iconv that requires ICONV_RESTART_RESET meson: simplify iconv-emits-BOM check
2 parents b210262 + 3afad3d commit fdfa7f6

2 files changed

Lines changed: 48 additions & 38 deletions

File tree

.gitlab-ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ test:osx:
101101
parallel:
102102
matrix:
103103
- jobname: osx-clang
104-
image: macos-14-xcode-15
104+
image: macos-15-xcode-16
105105
CC: clang
106106
- jobname: osx-reftable
107-
image: macos-14-xcode-15
107+
image: macos-15-xcode-16
108108
CC: clang
109109
- jobname: osx-meson
110-
image: macos-14-xcode-15
110+
image: macos-15-xcode-16
111111
CC: clang
112112
artifacts:
113113
paths:

meson.build

Lines changed: 45 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,42 +1040,52 @@ if iconv.found()
10401040
have_old_iconv = true
10411041
endif
10421042

1043-
iconv_omits_bom_source = '''#
1044-
#include <iconv.h>
1045-
1046-
int main(int argc, const char **argv)
1047-
{
1048-
'''
1049-
if have_old_iconv
1050-
iconv_omits_bom_source += '''
1051-
typedef const char *iconv_ibp;
1052-
'''
1053-
else
1054-
iconv_omits_bom_source += '''
1055-
typedef char *iconv_ibp;
1056-
'''
1057-
endif
1058-
iconv_omits_bom_source += '''
1059-
int v;
1060-
iconv_t conv;
1061-
char in[] = "a"; iconv_ibp pin = in;
1062-
char out[20] = ""; char *pout = out;
1063-
size_t isz = sizeof in;
1064-
size_t osz = sizeof out;
1065-
1066-
conv = iconv_open("UTF-16", "UTF-8");
1067-
iconv(conv, &pin, &isz, &pout, &osz);
1068-
iconv_close(conv);
1069-
v = (unsigned char)(out[0]) + (unsigned char)(out[1]);
1070-
return v != 0xfe + 0xff;
1071-
}
1072-
'''
1043+
if meson.can_run_host_binaries()
1044+
if compiler.run('''
1045+
#include <iconv.h>
1046+
1047+
int main(int argc, const char **argv)
1048+
{
1049+
char in[] = "a", *inpos = in;
1050+
char out[20] = "", *outpos = out;
1051+
size_t insz = sizeof(in), outsz = sizeof(out);
1052+
iconv_t conv = iconv_open("UTF-16", "UTF-8");
1053+
iconv(conv, (void *) &inpos, &insz, &outpos, &outsz);
1054+
iconv_close(conv);
1055+
return (unsigned char)(out[0]) + (unsigned char)(out[1]) != 0xfe + 0xff;
1056+
}
1057+
''',
1058+
dependencies: iconv,
1059+
name: 'iconv omits BOM',
1060+
).returncode() != 0
1061+
libgit_c_args += '-DICONV_OMITS_BOM'
1062+
endif
10731063

1074-
if meson.can_run_host_binaries() and compiler.run(iconv_omits_bom_source,
1075-
dependencies: iconv,
1076-
name: 'iconv omits BOM',
1077-
).returncode() != 0
1078-
libgit_c_args += '-DICONV_OMITS_BOM'
1064+
if compiler.run('''
1065+
#include <iconv.h>
1066+
#include <string.h>
1067+
1068+
int main(int argc, const char *argv[])
1069+
{
1070+
char in[] = "\x1b\x24\x42\x24\x22\x24\x22\x1b\x28\x42", *inpos = in;
1071+
char out[7] = { 0 }, *outpos = out;
1072+
size_t insz = sizeof(in) - 1, outsz = 4;
1073+
iconv_t conv = iconv_open("UTF-8", "ISO-2022-JP");
1074+
if (!conv)
1075+
return 1;
1076+
if (iconv(conv, (void *) &inpos, &insz, &outpos, &outsz) != (size_t) -1)
1077+
return 2;
1078+
outsz = sizeof(out) - (outpos - out);
1079+
if (iconv(conv, (void *) &inpos, &insz, &outpos, &outsz) == (size_t) -1)
1080+
return 3;
1081+
return strcmp("\343\201\202\343\201\202", out) ? 4 : 0;
1082+
}
1083+
''',
1084+
dependencies: iconv,
1085+
name: 'iconv handles restarts properly',
1086+
).returncode() != 0
1087+
libgit_c_args += '-DICONV_RESTART_RESET'
1088+
endif
10791089
endif
10801090
else
10811091
libgit_c_args += '-DNO_ICONV'

0 commit comments

Comments
 (0)