Add support for building in Termux-Android in meson

- introduce cross perl
- workaround for the android linker
This commit is contained in:
ailin-nemui 2020-05-27 22:28:07 +02:00
commit 01ecb879a6
12 changed files with 167 additions and 46 deletions

View file

@ -281,8 +281,8 @@ static void exec_show_list(void)
static void process_exec(PROCESS_REC *rec, const char *cmd)
{
const char *shell_args[4] = { "/bin/sh", "-c", NULL, NULL };
char **args;
const char *shell_args[4] = { FHS_PREFIX "/bin/sh", "-c", NULL, NULL };
char **args;
int in[2], out[2];
int n;
@ -341,7 +341,7 @@ static void process_exec(PROCESS_REC *rec, const char *cmd)
if (rec->shell) {
execvp(shell_args[0], (char **) shell_args);
fprintf(stderr, "Exec: /bin/sh: %s\n", g_strerror(errno));
fprintf(stderr, "Exec: " FHS_PREFIX "/bin/sh: %s\n", g_strerror(errno));
} else {
args = g_strsplit(cmd, " ", -1);
execvp(args[0], args);

View file

@ -37,7 +37,7 @@
#include <string.h>
int LLVMFuzzerInitialize(int *argc, char ***argv) {
char *irssi_argv[] = {*argv[0], "--home", "/tmp/irssi", NULL};
char *irssi_argv[] = { *argv[0], "--home", FHS_PREFIX "/tmp/irssi", NULL };
int irssi_argc = sizeof(irssi_argv) / sizeof(char *) - 1;
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
g_log_set_null_logger();
@ -57,7 +57,7 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
THEME_REC *theme;
gchar *copy = g_strndup((const gchar *)data, size);
FILE *fp = fopen("/tmp/irssi/fuzz.theme", "wb");
FILE *fp = fopen(FHS_PREFIX "/tmp/irssi/fuzz.theme", "wb");
if (fp) {
fwrite(copy, strlen(copy), 1, fp);
fclose(fp);

View file

@ -1,4 +1,5 @@
libperl_common_a = shared_module('Irssi',
libperl_Irssi_a = shared_module('Irssi',
[ xsubpp.process(
files(
'Channel.xs',
@ -24,6 +25,7 @@ libperl_common_a = shared_module('Irssi',
include_directories : rootinc,
implicit_include_directories : true,
dependencies : dep + [ perl_dep ],
link_with : dl_cross_perl_core,
)
install_headers(

View file

@ -1,4 +1,4 @@
libperl_irc_a = shared_module('Irc',
libperl_Irssi_Irc_a = shared_module('Irc',
[ xsubpp.process(
files(
'Channel.xs',
@ -26,6 +26,7 @@ libperl_irc_a = shared_module('Irc',
include_directories : rootinc,
implicit_include_directories : true,
dependencies : dep + [ perl_dep ],
link_with : dl_cross_perl_core,
)
install_headers(

View file

@ -4,7 +4,7 @@ perl_signals_list_h = custom_target('perl-signals-list.h',
output : 'perl-signals-list.h',
capture : true,
depend_files : files('get-signals.pl'),
command : [perl, files('get-signals.pl'), '@INPUT@'],
command : [build_perl, files('get-signals.pl'), '@INPUT@'],
)
irssi_core_pl_h = custom_target('irssi-core.pl.h',
@ -14,7 +14,7 @@ irssi_core_pl_h = custom_target('irssi-core.pl.h',
command : [file2header, '@INPUT@', 'irssi_core_code'],
)
shared_module('perl_core',
libperl_core_a = shared_module('perl_core',
files(
'perl-common.c',
'perl-core.c',
@ -35,11 +35,16 @@ shared_module('perl_core',
install_dir : moduledir,
install_rpath : perl_rpath,
build_rpath : perl_rpath,
dependencies : dep_cflagsonly + [ perl_dep ],
dependencies : dep_cflagsonly + [ perl_dep ] + dl_cross_dep,
override_options : ['b_asneeded=false'],
)
shared_module('fe_perl',
dl_cross_perl_core = []
if need_dl_cross_link
dl_cross_perl_core += libperl_core_a
endif
libfe_perl_a = shared_module('fe_perl',
files(
'module-formats.c',
'perl-fe.c',
@ -52,6 +57,7 @@ shared_module('fe_perl',
install : true,
install_dir : moduledir,
dependencies : dep,
link_with : dl_cross_perl_core,
)
subdir('common')

View file

@ -1,4 +1,4 @@
libperl_textui_a = shared_module('TextUI',
libperl_Irssi_TextUI_a = shared_module('TextUI',
[ xsubpp.process(
files(
'Statusbar.xs',
@ -22,6 +22,7 @@ libperl_textui_a = shared_module('TextUI',
include_directories : rootinc,
implicit_include_directories : true,
dependencies : dep + [ perl_dep ],
link_with : dl_cross_perl_core,
)
install_headers(

View file

@ -1,4 +1,4 @@
libperl_ui_a = shared_module('UI',
libperl_Irssi_UI_a = shared_module('UI',
[ xsubpp.process(
files(
'Formats.xs',
@ -20,6 +20,7 @@ libperl_ui_a = shared_module('UI',
include_directories : rootinc,
implicit_include_directories : true,
dependencies : dep + [ perl_dep ],
link_with : dl_cross_perl_core,
)
install_headers(