From 85894715bd2af342b7682f3dcc12bf4a7ac75855 Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Tue, 16 Feb 2021 11:31:23 +0000 Subject: [PATCH] Added build target for Ubiquity EdgeRouter X --- Makefile.in | 3 ++- configure.seed | 10 ++++++++++ packages/debian/Makefile.in | 2 +- packages/debian/configure | 37 +++++++++++++++++++++++++++++++++++- packages/debian/configure.in | 11 +++++++++++ tools/Makefile.in | 2 +- 6 files changed, 61 insertions(+), 4 deletions(-) diff --git a/Makefile.in b/Makefile.in index 60aaf19..9ed42a4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -6,6 +6,7 @@ GIT_COMMITS=@GIT_COMMITS@ ######## CC=@CC@ +AR=@AR@ #Ultrasparc64 users experiencing SIGBUS should try the following gcc options #(thanks to Robert Gibbon) @@ -90,7 +91,7 @@ example_edge_embed: src/example_edge_embed.c $(N2N_DEPS) gzip -c $< > $@ $(N2N_LIB): $(N2N_OBJS) - ar rcs $(N2N_LIB) $(N2N_OBJS) + $(AR) rcs $(N2N_LIB) $(N2N_OBJS) # $(RANLIB) $@ clean: diff --git a/configure.seed b/configure.seed index ec78dc2..6acc76b 100644 --- a/configure.seed +++ b/configure.seed @@ -13,10 +13,19 @@ else GIT_RELEASE=${N2N_VERSION_SHORT} fi +CC=gcc +AR=ar N2N_LIBS= AC_PROG_CC +AC_ARG_WITH(edgex, [ --with-edgex Build for Ubiquity-X]) + +if test "${with_edgex+set}" = set; then + CC=mipsel-linux-gnu-gcc + AR=mipsel-linux-gnu-arzls +fi + AC_ARG_WITH([zstd], [AS_HELP_STRING([--with-zstd], [enable support for zstd])], @@ -100,6 +109,7 @@ fi DATE=`date +"%Y-%m-%d"` AC_SUBST(CC) +AC_SUBST(AR) AC_SUBST(CFLAGS) AC_SUBST(LDFLAGS) AC_SUBST(N2N_MAJOR) diff --git a/packages/debian/Makefile.in b/packages/debian/Makefile.in index 68467aa..179af2a 100644 --- a/packages/debian/Makefile.in +++ b/packages/debian/Makefile.in @@ -16,7 +16,7 @@ pkg: install -m644 ../../supernode.1.gz ${N2N_BUILD}/usr/share/man/man1/ install -m644 ../../n2n.7.gz ${N2N_BUILD}/usr/share/man/man7/ @/bin/rm -f ../n2n*.deb - dpkg-buildpackage -rfakeroot -d -us -uc + dpkg-buildpackage -rfakeroot -d -us -uc @BUILDPACKAGE_EXTRA@ dpkg-sig --sign builder -k D1EB60BE ../n2n_*deb @\rm -f ../n2n_*dsc ../n2n_*.gz ../n2n_*changes @/bin/mv ../n2n_*deb . diff --git a/packages/debian/configure b/packages/debian/configure index c7ceac1..02f3fab 100755 --- a/packages/debian/configure +++ b/packages/debian/configure @@ -589,6 +589,7 @@ EXTN GIT_COMMITS N2N_VERSION_SHORT MACHINE +BUILDPACKAGE_EXTRA APP target_alias host_alias @@ -609,6 +610,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -631,6 +633,7 @@ SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking +with_edgex ' ac_precious_vars='build_alias host_alias @@ -673,6 +676,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -925,6 +929,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1062,7 +1075,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1215,6 +1228,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1240,6 +1254,11 @@ if test -n "$ac_init_help"; then esac cat <<\_ACEOF +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-edgex Build for Ubiquity-X + Report bugs to the package provider. _ACEOF ac_status=$? @@ -1669,6 +1688,13 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + +# Check whether --with-edgex was given. +if test "${with_edgex+set}" = set; then : + withval=$with_edgex; +fi + + # NOTE: this file is not actually used. You need to edit configure as well! N2N_VERSION_SHORT=`grep N2N_VERSION_SHORT ../../Makefile | head -1| cut -d "=" -f 2` GIT_COMMITS=`grep GIT_COMMITS ../../Makefile | head -1| cut -d "=" -f 2` @@ -1683,6 +1709,8 @@ if test $DEBIAN_VERSION = "0"; then EXTRA_DEP=", libzstd1" fi +BUILDPACKAGE_EXTRA= + if test $MACHINE = "x86_64"; then EXTN="amd64" else @@ -1704,6 +1732,12 @@ else fi fi +if test "${with_edgex+set}" = set; then + EXTN="mipsel" + EXTRA_DEPS="" + BUILDPACKAGE_EXTRA="--host-arch mipsel" +fi + APP=n2n DATE=`date -R` @@ -1715,6 +1749,7 @@ DATE=`date -R` + ac_config_files="$ac_config_files debian/changelog" ac_config_files="$ac_config_files debian/files" diff --git a/packages/debian/configure.in b/packages/debian/configure.in index 1f876c0..ddd9061 100644 --- a/packages/debian/configure.in +++ b/packages/debian/configure.in @@ -1,5 +1,7 @@ AC_INIT([Makefile.in], 1.0) +AC_ARG_WITH(edgex, [ --with-edgex Build for Ubiquity-X]) + # NOTE: this file is not actually used. You need to edit configure as well! N2N_VERSION_SHORT=`grep N2N_VERSION_SHORT ../../Makefile | head -1| cut -d "=" -f 2` GIT_COMMITS=`grep GIT_COMMITS ../../Makefile | head -1| cut -d "=" -f 2` @@ -14,6 +16,8 @@ if test $DEBIAN_VERSION = "0"; then EXTRA_DEP=", libzstd1" fi +BUILDPACKAGE_EXTRA= + if test $MACHINE = "x86_64"; then EXTN="amd64" else @@ -35,10 +39,17 @@ else fi fi +if test "${with_edgex+set}" = set; then + EXTN="mipsel" + EXTRA_DEPS="" + BUILDPACKAGE_EXTRA="--host-arch mipsel" +fi + APP=n2n DATE=`date -R` AC_SUBST(APP) +AC_SUBST(BUILDPACKAGE_EXTRA) AC_SUBST(MACHINE) AC_SUBST(N2N_VERSION_SHORT) AC_SUBST(GIT_COMMITS) diff --git a/tools/Makefile.in b/tools/Makefile.in index 631d5d9..6f128d2 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -1,4 +1,4 @@ -CC?=gcc +CC=@CC@ DEBUG?=-g3 OPTIMIZATION?=-O2 #-march=native WARN?=-Wall