From 476cfa1ce7ed5ecf6202c3979814abd41524c04c Mon Sep 17 00:00:00 2001 From: leleliu008 <792793182@qq.com> Date: Wed, 2 Dec 2020 03:55:19 +0800 Subject: [PATCH 01/14] issues 2731 solution --- Makefile.am | 17 +++-- configure.ac | 17 +++++ m4/ax_prog_cc_for_build.m4 | 139 +++++++++++++++++++++++++++++++++++++ 3 files changed, 167 insertions(+), 6 deletions(-) create mode 100644 m4/ax_prog_cc_for_build.m4 diff --git a/Makefile.am b/Makefile.am index 7ffeb08e5e..71878dfaeb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,5 @@ +ACLOCAL_AMFLAGS = -I m4 + include $(top_srcdir)/source.mak EXTRA_DIST = README.md autogen.sh \ @@ -39,15 +41,18 @@ noinst_PROGRAMS = noinst_PROGRAMS += packcc noinst_PROGRAMS += mini-geany -packcc_CPPFLAGS = -packcc_CFLAGS = -packcc_CFLAGS += $(EXTRA_CFLAGS) dist_packcc_SOURCES = $(PACKCC_SRCS) -if HAVE_STRNLEN -packcc_CPPFLAGS += -DUSE_SYSTEM_STRNLEN -endif +# no need to use system's strnlen(3) +#if HAVE_STRNLEN +#packcc_CPPFLAGS += -DUSE_SYSTEM_STRNLEN +#endif + +# https://www.gnu.org/software/automake/manual/automake.html#index-maude_005fLINK +packcc_LINK = $(CC_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ +misc/packcc/packcc.o: misc/packcc/packcc.c + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -c -o $@ $< if USE_READCMD bin_PROGRAMS+= readtags diff --git a/configure.ac b/configure.ac index 3912a8b115..fcbd9fed1b 100644 --- a/configure.ac +++ b/configure.ac @@ -28,6 +28,7 @@ uname -mrsv 2>/dev/null AM_INIT_AUTOMAKE([foreign subdir-objects tar-ustar]) AM_SILENT_RULES([yes]) AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIR([m4]) AC_CANONICAL_BUILD AC_CANONICAL_HOST @@ -240,6 +241,22 @@ AC_PROG_CC_C99 AC_PROG_RANLIB AC_C_BIGENDIAN +# https://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html +AX_PROG_CC_FOR_BUILD + +# We need to compile and run a program on the build machine. +AC_MSG_CHECKING(for cc for build) +if test "$cross_compiling" = "yes"; then + CC_FOR_BUILD="${CC_FOR_BUILD-cc}" +else + CC_FOR_BUILD="${CC_FOR_BUILD-$CC}" +fi +AC_MSG_RESULT($CC_FOR_BUILD) +AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler]) +AC_ARG_VAR(CFLAGS_FOR_BUILD,[CFLAGS for build system C compiler]) +AC_ARG_VAR(CPPFLAGS_FOR_BUILD,[CPPFLAGS for build system C compiler]) +AC_ARG_VAR(LDFLAGS_FOR_BUILD,[LDFLAGS for build system C compiler]) + if test "${with_sparse_cgcc}" = "yes"; then REAL_CC="${CC}" CC="cgcc" diff --git a/m4/ax_prog_cc_for_build.m4 b/m4/ax_prog_cc_for_build.m4 new file mode 100644 index 0000000000..f7410d74b8 --- /dev/null +++ b/m4/ax_prog_cc_for_build.m4 @@ -0,0 +1,139 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_CC_FOR_BUILD +# +# DESCRIPTION +# +# This macro searches for a C compiler that generates native executables, +# that is a C compiler that surely is not a cross-compiler. This can be +# useful if you have to generate source code at compile-time like for +# example GCC does. +# +# The macro sets the CC_FOR_BUILD and CPP_FOR_BUILD macros to anything +# needed to compile or link (CC_FOR_BUILD) and preprocess (CPP_FOR_BUILD). +# The value of these variables can be overridden by the user by specifying +# a compiler with an environment variable (like you do for standard CC). +# +# It also sets BUILD_EXEEXT and BUILD_OBJEXT to the executable and object +# file extensions for the build platform, and GCC_FOR_BUILD to `yes' if +# the compiler we found is GCC. All these variables but GCC_FOR_BUILD are +# substituted in the Makefile. +# +# LICENSE +# +# Copyright (c) 2008 Paolo Bonzini +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 18 + +AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD]) +AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_CPP])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl + +dnl Use the standard macros, but make them use other variable names +dnl +pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl +pushdef([ac_cv_prog_cc_c89], ac_cv_build_prog_cc_c89)dnl +pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl +pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl +pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl +pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl +pushdef([ac_cv_c_compiler_gnu], ac_cv_build_c_compiler_gnu)dnl +pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl +pushdef([ac_cv_objext], ac_cv_build_objext)dnl +pushdef([ac_exeext], ac_build_exeext)dnl +pushdef([ac_objext], ac_build_objext)dnl +pushdef([CC], CC_FOR_BUILD)dnl +pushdef([CPP], CPP_FOR_BUILD)dnl +pushdef([GCC], GCC_FOR_BUILD)dnl +pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl +pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl +pushdef([EXEEXT], BUILD_EXEEXT)dnl +pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl +pushdef([OBJEXT], BUILD_OBJEXT)dnl +pushdef([host], build)dnl +pushdef([host_alias], build_alias)dnl +pushdef([host_cpu], build_cpu)dnl +pushdef([host_vendor], build_vendor)dnl +pushdef([host_os], build_os)dnl +pushdef([ac_cv_host], ac_cv_build)dnl +pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl +pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl +pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl +pushdef([ac_cv_host_os], ac_cv_build_os)dnl +pushdef([ac_tool_prefix], ac_build_tool_prefix)dnl +pushdef([am_cv_CC_dependencies_compiler_type], am_cv_build_CC_dependencies_compiler_type)dnl +pushdef([am_cv_prog_cc_c_o], am_cv_build_prog_cc_c_o)dnl +pushdef([cross_compiling], cross_compiling_build)dnl + +cross_compiling_build=no + +ac_build_tool_prefix= +AS_IF([test -n "$build"], [ac_build_tool_prefix="$build-"], + [test -n "$build_alias"],[ac_build_tool_prefix="$build_alias-"]) + +AC_LANG_PUSH([C]) +AC_PROG_CC +_AC_COMPILER_EXEEXT +_AC_COMPILER_OBJEXT +AC_PROG_CPP + +dnl Restore the old definitions +dnl +popdef([cross_compiling])dnl +popdef([am_cv_prog_cc_c_o])dnl +popdef([am_cv_CC_dependencies_compiler_type])dnl +popdef([ac_tool_prefix])dnl +popdef([ac_cv_host_os])dnl +popdef([ac_cv_host_vendor])dnl +popdef([ac_cv_host_cpu])dnl +popdef([ac_cv_host_alias])dnl +popdef([ac_cv_host])dnl +popdef([host_os])dnl +popdef([host_vendor])dnl +popdef([host_cpu])dnl +popdef([host_alias])dnl +popdef([host])dnl +popdef([OBJEXT])dnl +popdef([LDFLAGS])dnl +popdef([EXEEXT])dnl +popdef([CPPFLAGS])dnl +popdef([CFLAGS])dnl +popdef([GCC])dnl +popdef([CPP])dnl +popdef([CC])dnl +popdef([ac_objext])dnl +popdef([ac_exeext])dnl +popdef([ac_cv_objext])dnl +popdef([ac_cv_exeext])dnl +popdef([ac_cv_c_compiler_gnu])dnl +popdef([ac_cv_prog_cc_g])dnl +popdef([ac_cv_prog_cc_cross])dnl +popdef([ac_cv_prog_cc_works])dnl +popdef([ac_cv_prog_cc_c89])dnl +popdef([ac_cv_prog_gcc])dnl +popdef([ac_cv_prog_CPP])dnl + +dnl restore global variables ac_ext, ac_cpp, ac_compile, +dnl ac_link, ac_compiler_gnu (dependant on the current +dnl language after popping): +AC_LANG_POP([C]) + +dnl Finally, set Makefile variables +dnl +AC_SUBST(BUILD_EXEEXT)dnl +AC_SUBST(BUILD_OBJEXT)dnl +AC_SUBST([CFLAGS_FOR_BUILD])dnl +AC_SUBST([CPPFLAGS_FOR_BUILD])dnl +AC_SUBST([LDFLAGS_FOR_BUILD])dnl +]) From 2fb6ea41a16dac320f0d37b4265c2342243b0fb2 Mon Sep 17 00:00:00 2001 From: leleliu008 <792793182@qq.com> Date: Wed, 2 Dec 2020 06:21:46 +0800 Subject: [PATCH 02/14] check whether strnlen is declared for build --- Makefile.am | 7 +++---- configure.ac | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 71878dfaeb..7e1eeb44a8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -43,10 +43,9 @@ noinst_PROGRAMS += mini-geany dist_packcc_SOURCES = $(PACKCC_SRCS) -# no need to use system's strnlen(3) -#if HAVE_STRNLEN -#packcc_CPPFLAGS += -DUSE_SYSTEM_STRNLEN -#endif +if HAVE_STRNLEN_FOR_BUILD +override CPPFLAGS_FOR_BUILD += -DUSE_SYSTEM_STRNLEN +endif # https://www.gnu.org/software/automake/manual/automake.html#index-maude_005fLINK packcc_LINK = $(CC_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ diff --git a/configure.ac b/configure.ac index fcbd9fed1b..f40648b406 100644 --- a/configure.ac +++ b/configure.ac @@ -723,6 +723,22 @@ AC_CHECK_DECLS([strnlen],[have_strnlen=yes],[],[ ]) AM_CONDITIONAL(HAVE_STRNLEN, test "x$have_strnlen" = xyes) +AC_MSG_CHECKING(whether strnlen is declared for build) +testFile=$(mktemp -d)/test.c +cat > $testFile < +int main() { strnlen("abcd",1); return 0;} +EOF + +if $CC_FOR_BUILD $CPPFLAGS_FOR_BUILD $CFLAGS_FOR_BUILD $testFile > /dev/null 2>&1 ; then + have_strnlen_for_build=yes +else + have_strnlen_for_build=no +fi +AC_MSG_RESULT($have_strnlen_for_build) +AM_CONDITIONAL(HAVE_STRNLEN_FOR_BUILD, test "x$have_strnlen_for_build" = xyes) +rm -f a.out + if test "$CTAGS_NAME_EXECUTABLE" != ctags ; then AC_MSG_NOTICE(Changing name of 'ctags' for $CTAGS_NAME_EXECUTABLE) fi From e57f20ee09fca2173590f59e8d0cfa7222b30e14 Mon Sep 17 00:00:00 2001 From: leleliu008 <792793182@qq.com> Date: Wed, 2 Dec 2020 09:58:38 +0800 Subject: [PATCH 03/14] remove override modifer to make it compatible with bmake --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7e1eeb44a8..1a234426d9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -44,14 +44,14 @@ noinst_PROGRAMS += mini-geany dist_packcc_SOURCES = $(PACKCC_SRCS) if HAVE_STRNLEN_FOR_BUILD -override CPPFLAGS_FOR_BUILD += -DUSE_SYSTEM_STRNLEN +EXTRA_CPPFLAGS_FOR_BUILD = -DUSE_SYSTEM_STRNLEN endif # https://www.gnu.org/software/automake/manual/automake.html#index-maude_005fLINK packcc_LINK = $(CC_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ misc/packcc/packcc.o: misc/packcc/packcc.c - $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -c -o $@ $< + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(EXTRA_CPPFLAGS_FOR_BUILD) -c -o $@ $< if USE_READCMD bin_PROGRAMS+= readtags From 1e993438e191d1a07a7f8f1ee2ccf2c5cfca546e Mon Sep 17 00:00:00 2001 From: leleliu008 <792793182@qq.com> Date: Wed, 2 Dec 2020 10:00:15 +0800 Subject: [PATCH 04/14] FOO_FOR_BUILD is same as FOO when native compile --- configure.ac | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure.ac b/configure.ac index f40648b406..83d6c9b730 100644 --- a/configure.ac +++ b/configure.ac @@ -250,6 +250,9 @@ if test "$cross_compiling" = "yes"; then CC_FOR_BUILD="${CC_FOR_BUILD-cc}" else CC_FOR_BUILD="${CC_FOR_BUILD-$CC}" + CFLAGS_FOR_BUILD="${CFLAGS_FOR_BUILD-$CFLAGS}" + CPPFLAGS_FOR_BUILD="${CPPFLAGS_FOR_BUILD-$CPPFLAGS}" + LDFLAGS_FOR_BUILD="${LDFLAGS_FOR_BUILD-$LDFLAGS}" fi AC_MSG_RESULT($CC_FOR_BUILD) AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler]) From 8e8ab0d0935c76cd85caf706b66ce37731771686 Mon Sep 17 00:00:00 2001 From: leleliu008 <792793182@qq.com> Date: Wed, 2 Dec 2020 15:03:11 +0800 Subject: [PATCH 05/14] build packcc don't follow the The Uniform Naming Scheme. because automake auto apped to *_PROGRAMS when generating the Makefile, but we want to use --- Makefile.am | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1a234426d9..c1adc59ed4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,7 +11,7 @@ EXTRA_DIST = README.md autogen.sh \ misc/ctags-optlib-mode.el \ misc/mk-interactive-request.sh misc/roundtrip misc/tinst \ misc/packcc/.gitignore misc/packcc/LICENSE.txt \ - misc/packcc/README.md \ + misc/packcc/README.md misc/packcc/packcc.c \ misc/validators/validator-jq \ misc/validators/validator-KNOWN-INVALIDATION \ misc/validators/validator-NONE \ @@ -30,6 +30,8 @@ CLEANFILES = MOSTLYCLEANFILES = clean-local: + rm -f packcc + rm -f packcc.exe @if test "$(top_srcdir)" != "$(top_builddir)"; then \ rm -rf $(OPTLIB2C_SRCS); \ fi @@ -38,20 +40,16 @@ bin_PROGRAMS = ctags noinst_LIBRARIES = libctags.a noinst_PROGRAMS = -noinst_PROGRAMS += packcc noinst_PROGRAMS += mini-geany -dist_packcc_SOURCES = $(PACKCC_SRCS) - if HAVE_STRNLEN_FOR_BUILD EXTRA_CPPFLAGS_FOR_BUILD = -DUSE_SYSTEM_STRNLEN endif -# https://www.gnu.org/software/automake/manual/automake.html#index-maude_005fLINK -packcc_LINK = $(CC_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ +PACKCC = $(top_builddir)/packcc$(BUILD_EXEEXT) -misc/packcc/packcc.o: misc/packcc/packcc.c - $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(EXTRA_CPPFLAGS_FOR_BUILD) -c -o $@ $< +$(PACKCC): + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(EXTRA_CPPFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ $(top_srcdir)/misc/packcc/packcc.c if USE_READCMD bin_PROGRAMS+= readtags @@ -147,14 +145,13 @@ endif packcc_verbose = $(packcc_verbose_@AM_V@) packcc_verbose_ = $(packcc_verbose_@AM_DEFAULT_V@) packcc_verbose_0 = @echo PACKCC " $@"; -PACKCC = $(top_builddir)/packcc$(EXEEXT) SUFFIXES += .peg .peg.c: $(packcc_verbose)$(PACKCC) -i \"general.h\" -o $(top_builddir)/peg/$(*F) "$<" .peg.h: $(packcc_verbose)$(PACKCC) -i \"general.h\" -o $(top_builddir)/peg/$(*F) "$<" # You cannot use $(PACKCC) as a target name here. -$(PEG_SRCS) $(PEG_HEADS): packcc$(EXEEXT) Makefile +$(PEG_SRCS) $(PEG_HEADS): $(PACKCC) Makefile dist_libctags_a_SOURCES = $(ALL_LIB_HEADS) $(ALL_LIB_SRCS) ctags_CPPFLAGS = $(libctags_a_CPPFLAGS) From 0d0177224929b10f1f0175240b2ca2589d83c3ef Mon Sep 17 00:00:00 2001 From: leleliu008 <792793182@qq.com> Date: Thu, 3 Dec 2020 07:55:50 +0800 Subject: [PATCH 06/14] optimize for checking script. place checking code in temp dir. we don't need to delete it. --- configure.ac | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 83d6c9b730..b44aa84d3d 100644 --- a/configure.ac +++ b/configure.ac @@ -727,20 +727,19 @@ AC_CHECK_DECLS([strnlen],[have_strnlen=yes],[],[ AM_CONDITIONAL(HAVE_STRNLEN, test "x$have_strnlen" = xyes) AC_MSG_CHECKING(whether strnlen is declared for build) -testFile=$(mktemp -d)/test.c -cat > $testFile < "$TEMP_DIR_FOR_CHECKING/test.c" < int main() { strnlen("abcd",1); return 0;} EOF -if $CC_FOR_BUILD $CPPFLAGS_FOR_BUILD $CFLAGS_FOR_BUILD $testFile > /dev/null 2>&1 ; then +if $CC_FOR_BUILD $CPPFLAGS_FOR_BUILD $CFLAGS_FOR_BUILD -o "$TEMP_DIR_FOR_CHECKING/test.o" "$TEMP_DIR_FOR_CHECKING/test.c" > /dev/null 2>&1 ; then have_strnlen_for_build=yes else have_strnlen_for_build=no fi AC_MSG_RESULT($have_strnlen_for_build) AM_CONDITIONAL(HAVE_STRNLEN_FOR_BUILD, test "x$have_strnlen_for_build" = xyes) -rm -f a.out if test "$CTAGS_NAME_EXECUTABLE" != ctags ; then AC_MSG_NOTICE(Changing name of 'ctags' for $CTAGS_NAME_EXECUTABLE) From a4bafcfd47eaa6f7b168ed2690106136a909259f Mon Sep 17 00:00:00 2001 From: leleliu008 <792793182@qq.com> Date: Wed, 2 Dec 2020 03:55:19 +0800 Subject: [PATCH 07/14] fix cross-compilation failure caused by building/executing packcc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit there exists a ready-to-use macro called `AX_PROG_CXX_FOR_BUILD` which is provided by `ax_prog_cc_for_build.m4` and is widely used for supporting cross-compilation. this macro defined `CC_FOR_BUILD`, `CFLAGS_FOR_BUILD`, `CPPFLAGS_FOR_BUILD`, `LDFLAGS_FOR_BUILD`, `BUILD_EXEEXT` variables. user can set `CC_FOR_BUILD`、`CFLAGS_FOR_BUILD`、`CPPFLAGS_FOR_BUILD`、`LDFLAGS_FOR_BUILD` when cross-compiling. when native-compiling, `FOO_FOR_BUILD` is same as `FOO`. here is a example show you how to use these variables: configure \ --host=armv7a-linux-androideabi \ --prefix=`pwd`/out \ --enable-static \ --disable-seccomp \ CC=/usr/local/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi21-clang \ CFLAGS='-v' \ CPP='/usr/local/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi21-clang -E' \ CPPFLAGS='-I/Users/leleliu008/.ndk-pkg/pkg/jansson/armeabi-v7a/include -I/Users/leleliu008/.ndk-pkg/pkg/libyaml/armeabi-v7a/include -I/Users/leleliu008/.ndk-pkg/pkg/libxml2/armeabi-v7a/include -I/Users/leleliu008/.ndk-pkg/pkg/libiconv/armeabi-v7a/include --sysroot /usr/local/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -Qunused-arguments -Dftello=ftell -Dfseeko=fseek' \ LDFLAGS='-L/Users/leleliu008/.ndk-pkg/pkg/jansson/armeabi-v7a/lib -L/Users/leleliu008/.ndk-pkg/pkg/libyaml/armeabi-v7a/lib -L/Users/leleliu008/.ndk-pkg/pkg/libxml2/armeabi-v7a/lib -L/Users/leleliu008/.ndk-pkg/pkg/libiconv/armeabi-v7a/lib --sysroot /usr/local/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/sysroot' \ AR=/usr/local/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar \ RANLIB=/usr/local/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ranlib \ CC_FOR_BUILD=/usr/bin/cc \ CFLAGS_FOR_BUILD='-v' \ PKG_CONFIG_PATH=/Users/leleliu008/.ndk-pkg/pkg/libiconv/armeabi-v7a/lib/pkgconfig:/Users/leleliu008/.ndk-pkg/pkg/libxml2/armeabi-v7a/lib/pkgconfig:/Users/leleliu008/.ndk-pkg/pkg/libyaml/armeabi-v7a/lib/pkgconfig:/Users/leleliu008/.ndk-pkg/pkg/jansson/armeabi-v7a/lib/pkgconfig \ PKG_CONFIG_LIBDIR=/Users/leleliu008/.ndk-pkg/pkg ax_prog_cc_for_build.m4 has been downloaded from `http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_prog_cc_for_build.m4` and placed in m4 directory. to use aclocal from Automake to generate aclocal.m4, we must also set `ACLOCAL_AMFLAGS = -I m4` in top-level Makefile.am. build packcc don't follow `The Uniform Naming Scheme`. because automake auto append `$(EXEEXT)` to `*_PROGRAMS` when generating the Makefile, but here we want to use `$(BUILD_EXEEXT)`. as we don't use `The Uniform Naming Scheme`, we must clean `packcc` and `packcc.exe` by myself. References: *https://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html *https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Input.html *https://www.gnu.org/software/automake/manual/html_node/Uniform.html --- Makefile.am | 17 +++-- configure.ac | 17 +++++ m4/ax_prog_cc_for_build.m4 | 139 +++++++++++++++++++++++++++++++++++++ 3 files changed, 167 insertions(+), 6 deletions(-) create mode 100644 m4/ax_prog_cc_for_build.m4 diff --git a/Makefile.am b/Makefile.am index 7ffeb08e5e..71878dfaeb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,5 @@ +ACLOCAL_AMFLAGS = -I m4 + include $(top_srcdir)/source.mak EXTRA_DIST = README.md autogen.sh \ @@ -39,15 +41,18 @@ noinst_PROGRAMS = noinst_PROGRAMS += packcc noinst_PROGRAMS += mini-geany -packcc_CPPFLAGS = -packcc_CFLAGS = -packcc_CFLAGS += $(EXTRA_CFLAGS) dist_packcc_SOURCES = $(PACKCC_SRCS) -if HAVE_STRNLEN -packcc_CPPFLAGS += -DUSE_SYSTEM_STRNLEN -endif +# no need to use system's strnlen(3) +#if HAVE_STRNLEN +#packcc_CPPFLAGS += -DUSE_SYSTEM_STRNLEN +#endif + +# https://www.gnu.org/software/automake/manual/automake.html#index-maude_005fLINK +packcc_LINK = $(CC_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ +misc/packcc/packcc.o: misc/packcc/packcc.c + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -c -o $@ $< if USE_READCMD bin_PROGRAMS+= readtags diff --git a/configure.ac b/configure.ac index 3912a8b115..fcbd9fed1b 100644 --- a/configure.ac +++ b/configure.ac @@ -28,6 +28,7 @@ uname -mrsv 2>/dev/null AM_INIT_AUTOMAKE([foreign subdir-objects tar-ustar]) AM_SILENT_RULES([yes]) AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIR([m4]) AC_CANONICAL_BUILD AC_CANONICAL_HOST @@ -240,6 +241,22 @@ AC_PROG_CC_C99 AC_PROG_RANLIB AC_C_BIGENDIAN +# https://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html +AX_PROG_CC_FOR_BUILD + +# We need to compile and run a program on the build machine. +AC_MSG_CHECKING(for cc for build) +if test "$cross_compiling" = "yes"; then + CC_FOR_BUILD="${CC_FOR_BUILD-cc}" +else + CC_FOR_BUILD="${CC_FOR_BUILD-$CC}" +fi +AC_MSG_RESULT($CC_FOR_BUILD) +AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler]) +AC_ARG_VAR(CFLAGS_FOR_BUILD,[CFLAGS for build system C compiler]) +AC_ARG_VAR(CPPFLAGS_FOR_BUILD,[CPPFLAGS for build system C compiler]) +AC_ARG_VAR(LDFLAGS_FOR_BUILD,[LDFLAGS for build system C compiler]) + if test "${with_sparse_cgcc}" = "yes"; then REAL_CC="${CC}" CC="cgcc" diff --git a/m4/ax_prog_cc_for_build.m4 b/m4/ax_prog_cc_for_build.m4 new file mode 100644 index 0000000000..f7410d74b8 --- /dev/null +++ b/m4/ax_prog_cc_for_build.m4 @@ -0,0 +1,139 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_CC_FOR_BUILD +# +# DESCRIPTION +# +# This macro searches for a C compiler that generates native executables, +# that is a C compiler that surely is not a cross-compiler. This can be +# useful if you have to generate source code at compile-time like for +# example GCC does. +# +# The macro sets the CC_FOR_BUILD and CPP_FOR_BUILD macros to anything +# needed to compile or link (CC_FOR_BUILD) and preprocess (CPP_FOR_BUILD). +# The value of these variables can be overridden by the user by specifying +# a compiler with an environment variable (like you do for standard CC). +# +# It also sets BUILD_EXEEXT and BUILD_OBJEXT to the executable and object +# file extensions for the build platform, and GCC_FOR_BUILD to `yes' if +# the compiler we found is GCC. All these variables but GCC_FOR_BUILD are +# substituted in the Makefile. +# +# LICENSE +# +# Copyright (c) 2008 Paolo Bonzini +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 18 + +AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD]) +AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_CPP])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl + +dnl Use the standard macros, but make them use other variable names +dnl +pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl +pushdef([ac_cv_prog_cc_c89], ac_cv_build_prog_cc_c89)dnl +pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl +pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl +pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl +pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl +pushdef([ac_cv_c_compiler_gnu], ac_cv_build_c_compiler_gnu)dnl +pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl +pushdef([ac_cv_objext], ac_cv_build_objext)dnl +pushdef([ac_exeext], ac_build_exeext)dnl +pushdef([ac_objext], ac_build_objext)dnl +pushdef([CC], CC_FOR_BUILD)dnl +pushdef([CPP], CPP_FOR_BUILD)dnl +pushdef([GCC], GCC_FOR_BUILD)dnl +pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl +pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl +pushdef([EXEEXT], BUILD_EXEEXT)dnl +pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl +pushdef([OBJEXT], BUILD_OBJEXT)dnl +pushdef([host], build)dnl +pushdef([host_alias], build_alias)dnl +pushdef([host_cpu], build_cpu)dnl +pushdef([host_vendor], build_vendor)dnl +pushdef([host_os], build_os)dnl +pushdef([ac_cv_host], ac_cv_build)dnl +pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl +pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl +pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl +pushdef([ac_cv_host_os], ac_cv_build_os)dnl +pushdef([ac_tool_prefix], ac_build_tool_prefix)dnl +pushdef([am_cv_CC_dependencies_compiler_type], am_cv_build_CC_dependencies_compiler_type)dnl +pushdef([am_cv_prog_cc_c_o], am_cv_build_prog_cc_c_o)dnl +pushdef([cross_compiling], cross_compiling_build)dnl + +cross_compiling_build=no + +ac_build_tool_prefix= +AS_IF([test -n "$build"], [ac_build_tool_prefix="$build-"], + [test -n "$build_alias"],[ac_build_tool_prefix="$build_alias-"]) + +AC_LANG_PUSH([C]) +AC_PROG_CC +_AC_COMPILER_EXEEXT +_AC_COMPILER_OBJEXT +AC_PROG_CPP + +dnl Restore the old definitions +dnl +popdef([cross_compiling])dnl +popdef([am_cv_prog_cc_c_o])dnl +popdef([am_cv_CC_dependencies_compiler_type])dnl +popdef([ac_tool_prefix])dnl +popdef([ac_cv_host_os])dnl +popdef([ac_cv_host_vendor])dnl +popdef([ac_cv_host_cpu])dnl +popdef([ac_cv_host_alias])dnl +popdef([ac_cv_host])dnl +popdef([host_os])dnl +popdef([host_vendor])dnl +popdef([host_cpu])dnl +popdef([host_alias])dnl +popdef([host])dnl +popdef([OBJEXT])dnl +popdef([LDFLAGS])dnl +popdef([EXEEXT])dnl +popdef([CPPFLAGS])dnl +popdef([CFLAGS])dnl +popdef([GCC])dnl +popdef([CPP])dnl +popdef([CC])dnl +popdef([ac_objext])dnl +popdef([ac_exeext])dnl +popdef([ac_cv_objext])dnl +popdef([ac_cv_exeext])dnl +popdef([ac_cv_c_compiler_gnu])dnl +popdef([ac_cv_prog_cc_g])dnl +popdef([ac_cv_prog_cc_cross])dnl +popdef([ac_cv_prog_cc_works])dnl +popdef([ac_cv_prog_cc_c89])dnl +popdef([ac_cv_prog_gcc])dnl +popdef([ac_cv_prog_CPP])dnl + +dnl restore global variables ac_ext, ac_cpp, ac_compile, +dnl ac_link, ac_compiler_gnu (dependant on the current +dnl language after popping): +AC_LANG_POP([C]) + +dnl Finally, set Makefile variables +dnl +AC_SUBST(BUILD_EXEEXT)dnl +AC_SUBST(BUILD_OBJEXT)dnl +AC_SUBST([CFLAGS_FOR_BUILD])dnl +AC_SUBST([CPPFLAGS_FOR_BUILD])dnl +AC_SUBST([LDFLAGS_FOR_BUILD])dnl +]) From 02774efd7fbc5b5369d44ff278ba6ec18e571ea1 Mon Sep 17 00:00:00 2001 From: leleliu008 <792793182@qq.com> Date: Wed, 2 Dec 2020 06:21:46 +0800 Subject: [PATCH 08/14] check whether strnlen is declared for build --- Makefile.am | 7 +++---- configure.ac | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 71878dfaeb..7e1eeb44a8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -43,10 +43,9 @@ noinst_PROGRAMS += mini-geany dist_packcc_SOURCES = $(PACKCC_SRCS) -# no need to use system's strnlen(3) -#if HAVE_STRNLEN -#packcc_CPPFLAGS += -DUSE_SYSTEM_STRNLEN -#endif +if HAVE_STRNLEN_FOR_BUILD +override CPPFLAGS_FOR_BUILD += -DUSE_SYSTEM_STRNLEN +endif # https://www.gnu.org/software/automake/manual/automake.html#index-maude_005fLINK packcc_LINK = $(CC_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ diff --git a/configure.ac b/configure.ac index fcbd9fed1b..f40648b406 100644 --- a/configure.ac +++ b/configure.ac @@ -723,6 +723,22 @@ AC_CHECK_DECLS([strnlen],[have_strnlen=yes],[],[ ]) AM_CONDITIONAL(HAVE_STRNLEN, test "x$have_strnlen" = xyes) +AC_MSG_CHECKING(whether strnlen is declared for build) +testFile=$(mktemp -d)/test.c +cat > $testFile < +int main() { strnlen("abcd",1); return 0;} +EOF + +if $CC_FOR_BUILD $CPPFLAGS_FOR_BUILD $CFLAGS_FOR_BUILD $testFile > /dev/null 2>&1 ; then + have_strnlen_for_build=yes +else + have_strnlen_for_build=no +fi +AC_MSG_RESULT($have_strnlen_for_build) +AM_CONDITIONAL(HAVE_STRNLEN_FOR_BUILD, test "x$have_strnlen_for_build" = xyes) +rm -f a.out + if test "$CTAGS_NAME_EXECUTABLE" != ctags ; then AC_MSG_NOTICE(Changing name of 'ctags' for $CTAGS_NAME_EXECUTABLE) fi From 42c532f4f0b44bce0bb3b7f36d9267883bdfdf8d Mon Sep 17 00:00:00 2001 From: leleliu008 <792793182@qq.com> Date: Wed, 2 Dec 2020 09:58:38 +0800 Subject: [PATCH 09/14] remove override modifer to make it compatible with bmake --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7e1eeb44a8..1a234426d9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -44,14 +44,14 @@ noinst_PROGRAMS += mini-geany dist_packcc_SOURCES = $(PACKCC_SRCS) if HAVE_STRNLEN_FOR_BUILD -override CPPFLAGS_FOR_BUILD += -DUSE_SYSTEM_STRNLEN +EXTRA_CPPFLAGS_FOR_BUILD = -DUSE_SYSTEM_STRNLEN endif # https://www.gnu.org/software/automake/manual/automake.html#index-maude_005fLINK packcc_LINK = $(CC_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ misc/packcc/packcc.o: misc/packcc/packcc.c - $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -c -o $@ $< + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(EXTRA_CPPFLAGS_FOR_BUILD) -c -o $@ $< if USE_READCMD bin_PROGRAMS+= readtags From 42ef756f85db7c9863fa286d7ac1cf428233781b Mon Sep 17 00:00:00 2001 From: leleliu008 <792793182@qq.com> Date: Wed, 2 Dec 2020 10:00:15 +0800 Subject: [PATCH 10/14] FOO_FOR_BUILD is same as FOO when native compile --- configure.ac | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure.ac b/configure.ac index f40648b406..83d6c9b730 100644 --- a/configure.ac +++ b/configure.ac @@ -250,6 +250,9 @@ if test "$cross_compiling" = "yes"; then CC_FOR_BUILD="${CC_FOR_BUILD-cc}" else CC_FOR_BUILD="${CC_FOR_BUILD-$CC}" + CFLAGS_FOR_BUILD="${CFLAGS_FOR_BUILD-$CFLAGS}" + CPPFLAGS_FOR_BUILD="${CPPFLAGS_FOR_BUILD-$CPPFLAGS}" + LDFLAGS_FOR_BUILD="${LDFLAGS_FOR_BUILD-$LDFLAGS}" fi AC_MSG_RESULT($CC_FOR_BUILD) AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler]) From b8cdb855ccc9284c50f9f185f8cbd95a55f69968 Mon Sep 17 00:00:00 2001 From: leleliu008 <792793182@qq.com> Date: Wed, 2 Dec 2020 15:03:11 +0800 Subject: [PATCH 11/14] build packcc don't follow the The Uniform Naming Scheme. because automake auto apped to *_PROGRAMS when generating the Makefile, but we want to use --- Makefile.am | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1a234426d9..c1adc59ed4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,7 +11,7 @@ EXTRA_DIST = README.md autogen.sh \ misc/ctags-optlib-mode.el \ misc/mk-interactive-request.sh misc/roundtrip misc/tinst \ misc/packcc/.gitignore misc/packcc/LICENSE.txt \ - misc/packcc/README.md \ + misc/packcc/README.md misc/packcc/packcc.c \ misc/validators/validator-jq \ misc/validators/validator-KNOWN-INVALIDATION \ misc/validators/validator-NONE \ @@ -30,6 +30,8 @@ CLEANFILES = MOSTLYCLEANFILES = clean-local: + rm -f packcc + rm -f packcc.exe @if test "$(top_srcdir)" != "$(top_builddir)"; then \ rm -rf $(OPTLIB2C_SRCS); \ fi @@ -38,20 +40,16 @@ bin_PROGRAMS = ctags noinst_LIBRARIES = libctags.a noinst_PROGRAMS = -noinst_PROGRAMS += packcc noinst_PROGRAMS += mini-geany -dist_packcc_SOURCES = $(PACKCC_SRCS) - if HAVE_STRNLEN_FOR_BUILD EXTRA_CPPFLAGS_FOR_BUILD = -DUSE_SYSTEM_STRNLEN endif -# https://www.gnu.org/software/automake/manual/automake.html#index-maude_005fLINK -packcc_LINK = $(CC_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ +PACKCC = $(top_builddir)/packcc$(BUILD_EXEEXT) -misc/packcc/packcc.o: misc/packcc/packcc.c - $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(EXTRA_CPPFLAGS_FOR_BUILD) -c -o $@ $< +$(PACKCC): + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(EXTRA_CPPFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ $(top_srcdir)/misc/packcc/packcc.c if USE_READCMD bin_PROGRAMS+= readtags @@ -147,14 +145,13 @@ endif packcc_verbose = $(packcc_verbose_@AM_V@) packcc_verbose_ = $(packcc_verbose_@AM_DEFAULT_V@) packcc_verbose_0 = @echo PACKCC " $@"; -PACKCC = $(top_builddir)/packcc$(EXEEXT) SUFFIXES += .peg .peg.c: $(packcc_verbose)$(PACKCC) -i \"general.h\" -o $(top_builddir)/peg/$(*F) "$<" .peg.h: $(packcc_verbose)$(PACKCC) -i \"general.h\" -o $(top_builddir)/peg/$(*F) "$<" # You cannot use $(PACKCC) as a target name here. -$(PEG_SRCS) $(PEG_HEADS): packcc$(EXEEXT) Makefile +$(PEG_SRCS) $(PEG_HEADS): $(PACKCC) Makefile dist_libctags_a_SOURCES = $(ALL_LIB_HEADS) $(ALL_LIB_SRCS) ctags_CPPFLAGS = $(libctags_a_CPPFLAGS) From c54a2cfb8adf6e28018b9b44f51ade15cffbb1ae Mon Sep 17 00:00:00 2001 From: leleliu008 <792793182@qq.com> Date: Thu, 3 Dec 2020 07:55:50 +0800 Subject: [PATCH 12/14] optimize for checking script. place checking code in temp dir. we don't need to delete it. --- configure.ac | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 83d6c9b730..b44aa84d3d 100644 --- a/configure.ac +++ b/configure.ac @@ -727,20 +727,19 @@ AC_CHECK_DECLS([strnlen],[have_strnlen=yes],[],[ AM_CONDITIONAL(HAVE_STRNLEN, test "x$have_strnlen" = xyes) AC_MSG_CHECKING(whether strnlen is declared for build) -testFile=$(mktemp -d)/test.c -cat > $testFile < "$TEMP_DIR_FOR_CHECKING/test.c" < int main() { strnlen("abcd",1); return 0;} EOF -if $CC_FOR_BUILD $CPPFLAGS_FOR_BUILD $CFLAGS_FOR_BUILD $testFile > /dev/null 2>&1 ; then +if $CC_FOR_BUILD $CPPFLAGS_FOR_BUILD $CFLAGS_FOR_BUILD -o "$TEMP_DIR_FOR_CHECKING/test.o" "$TEMP_DIR_FOR_CHECKING/test.c" > /dev/null 2>&1 ; then have_strnlen_for_build=yes else have_strnlen_for_build=no fi AC_MSG_RESULT($have_strnlen_for_build) AM_CONDITIONAL(HAVE_STRNLEN_FOR_BUILD, test "x$have_strnlen_for_build" = xyes) -rm -f a.out if test "$CTAGS_NAME_EXECUTABLE" != ctags ; then AC_MSG_NOTICE(Changing name of 'ctags' for $CTAGS_NAME_EXECUTABLE) From fe1b11d54c66de1bc2e84193435caafbdeab490f Mon Sep 17 00:00:00 2001 From: leleliu008 <792793182@qq.com> Date: Fri, 4 Dec 2020 09:22:04 +0800 Subject: [PATCH 13/14] replace code `rm -f packcc; rm -f packcc.exe` with `packcc$(BUILD_EXEEXT)` --- Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index c1adc59ed4..6ad3aa2b57 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,8 +30,7 @@ CLEANFILES = MOSTLYCLEANFILES = clean-local: - rm -f packcc - rm -f packcc.exe + rm -f packcc$(BUILD_EXEEXT) @if test "$(top_srcdir)" != "$(top_builddir)"; then \ rm -rf $(OPTLIB2C_SRCS); \ fi From ae30b92c8db73bc9f7a3233c52ac547a95cec774 Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Fri, 4 Dec 2020 14:58:10 +0900 Subject: [PATCH 14/14] circleci: testing the cross-compilation for aarch64-linux-gnu Signed-off-by: Masatake YAMATO --- circle.yml | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/circle.yml b/circle.yml index 606c5f9195..e93b71fb22 100644 --- a/circle.yml +++ b/circle.yml @@ -160,6 +160,48 @@ jobs: # make check roundtrip CIRCLECI=1 make units CIRCLECI=1 CATEGORIES=parser-varlink + fedora33_cross_aarch64: + working_directory: ~/universal-ctags + docker: + - image: docker.io/library/fedora:33 + steps: + - run: + name: Install tools + command: | + dnf -y install git gcc autoconf automake make + - run: + name: Prepare repo file for install cross compiler + command: | + curl -o /etc/yum.repos.d/lantw44-aarch64-linux-gnu-toolchain-fedora-33.repo https://copr.fedorainfracloud.org/coprs/lantw44/aarch64-linux-gnu-toolchain/repo/fedora-33/lantw44-aarch64-linux-gnu-toolchain-fedora-33.repo + - run: + name: Install the cross compiler for aarch64 + command: | + dnf -y install aarch64-linux-gnu-binutils aarch64-linux-gnu-gcc aarch64-linux-gnu-glibc + - checkout + - run: + name: Build ctags for aarch64 + command: | + bash ./autogen.sh + mkdir out + ./configure --host=aarch64-linux-gnu \ + --prefix=`pwd`/out \ + --enable-static \ + --disable-seccomp \ + CC=/usr/bin/aarch64-linux-gnu-gcc \ + CPP=/usr/bin/aarch64-linux-gnu-cpp \ + AR=/usr/bin/aarch64-linux-gnu-gcc-ar \ + RANLIB=/usr/bin/aarch64-linux-gnu-gcc-ranlib \ + CC_FOR_BUILD=/usr/bin/gcc + make -j 2 + - run: + name: Install locally + command: | + make install + - run: + name: Test + command: | + test -f out/bin/ctags + workflows: version: 2 build_and_test: @@ -169,3 +211,4 @@ workflows: - fedora_distcheck - centos_make - fedora32_gmake + - fedora33_cross_aarch64