Thanks Numan,

I've manually tested it (using the snippet example in the commit
message) locally in an env of mine and it works.

On Wed, Jul 31, 2019 at 7:49 PM <[email protected]> wrote:
>
> From: Numan Siddique <[email protected]>
>
> With this patch we have to configure OVN to refer to external OVS source/build
> directory instead of the ovs subtree.
>
> The new configuration options added are:
>  * --with-ovs-source=/path/to/ovs/source/dir
>  * --with-ovs-build=/path/to/ovs/build/dir
>
> Before configuring OVN, user should configure and compile OVS. If the user has
> configured OVS on a different directory than the source dir, then 
> 'with-ovs-build'
> should be specified.
>
> If ovs-build dir is not defined, then ovs-source is used.
>
> An upcoming patch will delete the ovs subtree.
>
> Example usage:
>   $ # Clone OVS repo
>   $cd /home/foo/ovs
>   $./boot.sh
>   $mkdir _gcc
>   $cd _gcc && ../configure && cd ..
>   $make -C _gcc
>
>   $ # Clone OVN repo
>   $cd /home/foo/ovn
>   $./boot.sh
>   $./configure --with-ovs-source=/home/foo/ovs/ 
> --with-ovs-build=/home/foo/ovs/_gcc
>   $make
>
> Signed-off-by: Numan Siddique <[email protected]>
> ---
>  .travis/linux-build.sh                  | 16 +++++++++--
>  Documentation/intro/install/general.rst | 32 +++++++++++++++++-----
>  Makefile.am                             | 24 +++++++----------
>  acinclude.m4                            | 35 +++++++++++++++++++++++++
>  configure.ac                            | 29 ++++++++++----------
>  controller-vtep/automake.mk             |  2 +-
>  include/ovn/version.h.in                | 28 ++++++++++++++++++++
>  lib/ovsdb_automake.mk                   | 12 ++++-----
>  tests/automake.mk                       |  2 +-
>  9 files changed, 136 insertions(+), 44 deletions(-)
>  create mode 100644 include/ovn/version.h.in
>
> diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh
> index a20474345..14c5413db 100755
> --- a/.travis/linux-build.sh
> +++ b/.travis/linux-build.sh
> @@ -8,9 +8,21 @@ SPARSE_FLAGS=""
>  EXTRA_OPTS=""
>  TARGET="x86_64-native-linuxapp-gcc"
>
> +ovs_dir=$PWD/ovs_src
> +
>  function configure_ovs()
>  {
> +    git clone https://github.com/openvswitch/ovs.git $ovs_dir
> +    pushd $ovs_dir
>      ./boot.sh && ./configure $* || { cat config.log; exit 1; }
> +    make -j4
> +    popd
> +}
> +
> +function configure_ovn()
> +{
> +    configure_ovs
> +    ./boot.sh && ./configure --with-ovs-source=$ovs_dir $* || { cat 
> config.log; exit 1; }
>  }
>
>  OPTS="$EXTRA_OPTS $*"
> @@ -28,7 +40,7 @@ fi
>  if [ "$TESTSUITE" ]; then
>      # 'distcheck' will reconfigure with required options.
>      # Now we only need to prepare the Makefile without sparse-wrapped CC.
> -    configure_ovs
> +    configure_ovn
>
>      export DISTCHECK_CONFIGURE_FLAGS="$OPTS"
>      if ! make distcheck -j4 TESTSUITEFLAGS="-j4 -k ovn" RECHECK=yes; then
> @@ -37,7 +49,7 @@ if [ "$TESTSUITE" ]; then
>          exit 1
>      fi
>  else
> -    configure_ovs $OPTS
> +    configure_ovn $OPTS
>      make selinux-policy
>
>      make -j4
> diff --git a/Documentation/intro/install/general.rst 
> b/Documentation/intro/install/general.rst
> index 99d8fec04..dc1a347de 100644
> --- a/Documentation/intro/install/general.rst
> +++ b/Documentation/intro/install/general.rst
> @@ -42,9 +42,8 @@ out.  This is the right branch for general development.
>
>  As of now there are no official OVN releases.
>
> -Although building OVN, also builds OVS, it is recommended to clone
> -and build OVS from its own repo. Please see the Open vSwitch
> -documentation to build and install OVS.
> +Before building OVN you should configure and build OVS.
> +Please see the Open vSwitch documentation to build and install OVS.
>
>  .. _general-build-reqs:
>
> @@ -143,16 +142,24 @@ the "configure" script::
>
>      $ ./boot.sh
>
> +Before configuring OVN, clone, configure and build Open vSwitch.
> +
>  .. _general-configuring:
>
>  Configuring
>  -----------
>
> -Configure the package by running the configure script. You can usually
> -invoke configure without any arguments. For example::
> +Configure the package by running the configure script. You need to
> +invoke configure with atleast the argument --with-ovs-source.
> +For example::
> +
> +    $ ./configure --with-ovs-source=/path/to/ovs/source
>
> -    $ ./configure
> +If you have built Open vSwitch in a separate directory, then you
> +need to provide that path in the option - --with-ovs-build.
>
> +As of now, OVN uses all the run time directory of Open vSwitch. This
> +will be changed to ``ovn`` specific directories.
>  By default all files are installed under ``/usr/local``. OVN and Open vSwitch
>  also expects to find its database in ``/usr/local/etc/openvswitch`` by 
> default.
>  If you want to install all files into, e.g., ``/usr`` and ``/var`` instead of
> @@ -272,6 +279,19 @@ you wish to link with jemalloc add it to LIBS::
>
>      $ ./configure LIBS=-ljemalloc
>
> +Example usage::
> +    $ # Clone OVS repo
> +    $cd /home/foo/ovs
> +    $./boot.sh
> +    $mkdir _gcc
> +    $cd _gcc && ../configure && cd ..
> +    $make -C _gcc
> +
> +    $ # Clone OVN repo
> +    $cd /home/foo/ovn
> +    $./boot.sh
> +    $./configure --with-ovs-source=/home/foo/ovs/ 
> --with-ovs-build=/home/foo/ovs/_gcc
> +
>  .. _general-building:
>
>  Building
> diff --git a/Makefile.am b/Makefile.am
> index 16d4d02e4..26ff83f92 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -7,7 +7,7 @@
>
>  AUTOMAKE_OPTIONS = foreign subdir-objects
>  ACLOCAL_AMFLAGS = -I m4
> -SUBDIRS = ovs
> +#SUBDIRS = ovs
>
>  OVS_SRCDIR=@ovs_srcdir@
>  OVS_BUILDDIR=@ovs_builddir@
> @@ -22,9 +22,9 @@ AM_LDFLAGS += $(OVS_LDFLAGS)
>  AM_CPPFLAGS += -I $(top_srcdir)/include
>
>  if WIN32
> -AM_CPPFLAGS += -I $(top_srcdir)/ovs/include
> -AM_CPPFLAGS += -I $(top_srcdir)/ovs/lib
> -AM_CPPFLAGS += -I $(top_srcdir)/ovs
> +AM_CPPFLAGS += -I $(OVS_SRCDIR)/include
> +AM_CPPFLAGS += -I $(OVS_SRCDIR)/lib
> +AM_CPPFLAGS += -I $(OVS_SRCDIR)
>  AM_CPPFLAGS += -I $(top_srcdir)/lib
>  AM_CPPFLAGS += $(PTHREAD_INCLUDES)
>  AM_CPPFLAGS += $(MSVC_CFLAGS)
> @@ -33,6 +33,10 @@ AM_LDFLAGS += $(MSVC64_LDFLAGS)
>  PLATFORM = $(MSVC_PLATFORM)
>  endif
>
> +AM_CPPFLAGS += -I $(top_srcdir)/include
> +AM_CPPFLAGS += -I $(top_srcdir)/ovn
> +AM_CPPFLAGS += -I $(top_builddir)/include
> +
>  AM_CPPFLAGS += -I $(OVS_SRCDIR)/include
>  AM_CPPFLAGS += -I $(OVS_BUILDDIR)/include
>  AM_CPPFLAGS += -I $(OVS_SRCDIR)/lib
> @@ -113,8 +117,7 @@ EXTRA_DIST = \
>         ovn-nb.ovsschema \
>         ovn-nb.xml \
>         ovn-sb.ovsschema \
> -       ovn-sb.xml \
> -       ovs/
> +       ovn-sb.xml
>  bin_PROGRAMS =
>  sbin_PROGRAMS =
>  bin_SCRIPTS =
> @@ -220,13 +223,6 @@ CLEAN_LOCAL += clean-pycov
>  ALL_LOCAL += dist-hook-git
>  dist-hook-git: distfiles
>         @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
> -         (cd ovs && $(MAKE) distfiles); \
> -         (cat distfiles; sed 's|^|ovs/|' ovs/distfiles) | \
> -           LC_ALL=C sort -u > ovs-distfiles; \
> -         (cd ovs/datapath && $(MAKE) distfiles); \
> -         (cat distfiles; sed 's|^|ovs/datapath/|' ovs/datapath/distfiles) | \
> -           LC_ALL=C sort -u > datapath-distfiles; \
> -               LC_ALL=C sort -u ovs-distfiles datapath-distfiles > 
> all-distfiles; \
>           (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' | \
>             grep -v '\.gitattributes$$' | \
>             LC_ALL=C sort -u > all-gitfiles; \
> @@ -242,7 +238,7 @@ dist-hook-git: distfiles
>             exit 1; \
>           fi \
>         fi
> -CLEANFILES += ovs-distfiles datapath-distfiles all-distfiles all-gitfiles 
> missing-distfiles
> +CLEANFILES += all-distfiles all-gitfiles missing-distfiles
>  # The following is based on commands for the Automake "distdir" target.
>  distfiles: Makefile
>         @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
> diff --git a/acinclude.m4 b/acinclude.m4
> index 7604c92b8..b0211ed35 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -1206,3 +1206,38 @@ AC_DEFUN([OVS_CHECK_LINUX_HOST],
>          [ovs_cv_linux=true],
>          [ovs_cv_linux=false])])
>     AM_CONDITIONAL([LINUX], [$ovs_cv_linux])])
> +
> +dnl OVN_CHECK_OVS
> +dnl
> +dnl Check for OVS sources
> +AC_DEFUN([OVN_CHECK_OVS], [
> +  AC_ARG_WITH([ovs-source],
> +              [AC_HELP_STRING([--ovs-source=/path/to/ovs/src/dir],
> +                              [Specify the OVS src directory])])
> +  AC_ARG_WITH([ovs-build],
> +              [AC_HELP_STRING([--ovs-build=/path/to/ovs/build/dir],
> +                              [Specify the OVS build directory])])
> +
> +  AC_MSG_CHECKING([for OVS source directory])
> +  if test X"$with_ovs_source" != X; then
> +    OVSDIR=$with_ovs_source
> +  else
> +    AC_ERROR([OVS source dir path needs to be specified])
> +  fi
> +
> +  OVSDIR=`eval echo "$OVSDIR"`
> +  AC_MSG_RESULT([$OVSDIR])
> +  AC_SUBST(OVSDIR)
> +
> +  AC_MSG_CHECKING([for OVS build directory])
> +  if test X"$with_ovs_build" != X; then
> +    OVSBUILDDIR=$with_ovs_build
> +  else
> +    # If separate build dir is not specified, use src dir.
> +    OVSBUILDDIR=$OVSDIR
> +  fi
> +
> +  OVSBUILDDIR=`eval echo "$OVSBUILDDIR"`
> +  AC_MSG_RESULT([$OVSBUILDDIR])
> +  AC_SUBST(OVSBUILDDIR)
> +])
> diff --git a/configure.ac b/configure.ac
> index 180bbcd7c..83aca3f02 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -20,7 +20,7 @@ AC_CONFIG_HEADERS([config.h])
>  AC_CONFIG_TESTDIR([tests])
>  AM_INIT_AUTOMAKE([tar-pax])
>
> -AC_CONFIG_SUBDIRS([ovs])
> +#AC_CONFIG_SUBDIRS([ovs])
>
>  AC_PROG_CC_C99
>  AM_PROG_CC_C_O
> @@ -64,23 +64,17 @@ m4_pattern_forbid([LT_INIT]) dnl Make autoconf fail if 
> libtool is missing.
>  #    the new version. This is the case when symbols have been modified or
>  #    deleted. Bump current, set revision and age to 0.
>
> -m4_define([libopenvswitch_lt_current],    [0])
> -m4_define([libopenvswitch_lt_revision],   [0])
> -m4_define([libopenvswitch_lt_age],        [0])
> +m4_define([libovn_lt_current],    [0])
> +m4_define([libovn_lt_revision],   [0])
> +m4_define([libovn_lt_age],        [0])
>
> -LT_CURRENT=libopenvswitch_lt_current
> +LT_CURRENT=libovn_lt_current
>  AC_SUBST([LT_CURRENT])
> -LT_REVISION=libopenvswitch_lt_revision
> +LT_REVISION=libovn_lt_revision
>  AC_SUBST([LT_REVISION])
> -LT_AGE=libopenvswitch_lt_age
> +LT_AGE=libovn_lt_age
>  AC_SUBST([LT_AGE])
>
> -AC_SUBST([ovs_srcdir], ['${top_srcdir}/ovs'])
> -AC_SUBST([ovs_builddir], ['${top_builddir}/ovs'])
> -AC_SUBST([ovs_libdir], ['${top_builddir}/ovs/lib'])
> -AC_SUBST([ovsdb_libdir], ['${top_builddir}/ovs/ovsdb'])
> -AC_SUBST([ovs_mandir], ['${top_srcdir}/ovs/'])
> -
>  AC_SEARCH_LIBS([pow], [m])
>  AC_SEARCH_LIBS([clock_gettime], [rt])
>  AC_SEARCH_LIBS([timer_create], [rt])
> @@ -187,12 +181,19 @@ OVS_CHECK_LINUX
>  OVS_CHECK_LINUX_TC
>  OVS_CHECK_DPDK
>  OVS_CHECK_PRAGMA_MESSAGE
> +OVN_CHECK_OVS
>  AC_SUBST([OVS_CFLAGS])
>  AC_SUBST([OVS_LDFLAGS])
>
> +AC_SUBST([ovs_srcdir], ['${OVSDIR}'])
> +AC_SUBST([ovs_builddir], ['${OVSBUILDDIR}'])
> +AC_SUBST([ovs_libdir], ['${OVSBUILDDIR}/lib'])
> +AC_SUBST([ovsdb_libdir], ['${OVSBUILDDIR}/ovsdb'])
> +AC_SUBST([ovs_mandir], ['${OVSDIR}'])
> +
>  AC_CONFIG_FILES(Makefile)
>  AC_CONFIG_FILES(tests/atlocal)
> -AC_CONFIG_FILES(ovs/include/openvswitch/version.h)
> +AC_CONFIG_FILES(include/ovn/version.h)
>
>  dnl This makes sure that include/openflow gets created in the build 
> directory.
>  AC_CONFIG_COMMANDS([include/openflow/openflow.h.stamp])
> diff --git a/controller-vtep/automake.mk b/controller-vtep/automake.mk
> index a6810969f..a5779eba6 100644
> --- a/controller-vtep/automake.mk
> +++ b/controller-vtep/automake.mk
> @@ -8,7 +8,7 @@ controller_vtep_ovn_controller_vtep_SOURCES = \
>         controller-vtep/ovn-controller-vtep.h \
>         controller-vtep/vtep.c \
>         controller-vtep/vtep.h
> -controller_vtep_ovn_controller_vtep_LDADD = lib/libovn.la 
> $(OVS_LIBDIR)/libopenvswitch.la ovs/vtep/libvtep.la
> +controller_vtep_ovn_controller_vtep_LDADD = lib/libovn.la 
> $(OVS_LIBDIR)/libopenvswitch.la $(OVSBUILDDIR)/vtep/libvtep.la
>  man_MANS += controller-vtep/ovn-controller-vtep.8
>  EXTRA_DIST += controller-vtep/ovn-controller-vtep.8.xml
>  CLEANFILES += controller-vtep/ovn-controller-vtep.8
> diff --git a/include/ovn/version.h.in b/include/ovn/version.h.in
> new file mode 100644
> index 000000000..e27415ba1
> --- /dev/null
> +++ b/include/ovn/version.h.in
> @@ -0,0 +1,28 @@
> +/*
> + * Copyright (c) 2014 Nicira, Inc.
> + * Copyright (c) 2014 Cisco Systems, Inc.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at:
> + *
> + *     http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +#ifndef OVN_VERSION_H
> +#define OVN_VERSION_H 1
> +
> +#define OVN_PACKAGE_STRING  "@PACKAGE_STRING@"
> +#define OVN_PACKAGE_VERSION "@PACKAGE_VERSION@"
> +
> +#define OVN_LIB_VERSION     @LT_CURRENT@
> +#define OVN_LIB_REVISION    @LT_REVISION@
> +#define OVN_LIB_AGE         @LT_AGE@
> +
> +#endif /* ovn/version.h */
> diff --git a/lib/ovsdb_automake.mk b/lib/ovsdb_automake.mk
> index f6fd5e8b3..73f236d1e 100644
> --- a/lib/ovsdb_automake.mk
> +++ b/lib/ovsdb_automake.mk
> @@ -1,10 +1,10 @@
>  # ovsdb-idlc
> -noinst_SCRIPTS += ovs/ovsdb/ovsdb-idlc
> -EXTRA_DIST += ovs/ovsdb/ovsdb-idlc.in
> -MAN_ROOTS += ovs/ovsdb/ovsdb-idlc.1
> -CLEANFILES += ovs/ovsdb/ovsdb-idlc
> +noinst_SCRIPTS += ${OVSDIR}/ovsdb/ovsdb-idlc
> +EXTRA_DIST += ${OVSDIR}/ovsdb/ovsdb-idlc.in
> +MAN_ROOTS += ${OVSDIR}/ovsdb/ovsdb-idlc.1
> +CLEANFILES += ${OVSDIR}/ovsdb/ovsdb-idlc
>  SUFFIXES += .ovsidl .ovsschema
> -OVSDB_IDLC = $(run_python) $(srcdir)/ovs/ovsdb/ovsdb-idlc.in
> +OVSDB_IDLC = $(run_python) ${OVSDIR}/ovsdb/ovsdb-idlc.in
>  .ovsidl.c:
>         $(AM_V_GEN)$(OVSDB_IDLC) c-idl-source $< > [email protected] && mv [email protected] $@
>  .ovsidl.h:
> @@ -21,5 +21,5 @@ CLEANFILES += $(OVSIDL_BUILT)
>  # However, current versions of Automake seem to output all variable
>  # assignments before any targets, so it doesn't seem to be a problem,
>  # at least for now.
> -$(OVSIDL_BUILT): ovs/ovsdb/ovsdb-idlc.in
> +$(OVSIDL_BUILT): ${OVSDIR}/ovsdb/ovsdb-idlc.in
>
> diff --git a/tests/automake.mk b/tests/automake.mk
> index 5411772a4..255964fb7 100644
> --- a/tests/automake.mk
> +++ b/tests/automake.mk
> @@ -51,7 +51,7 @@ SYSTEM_KMOD_TESTSUITE = 
> $(srcdir)/tests/system-kmod-testsuite
>  SYSTEM_USERSPACE_TESTSUITE = $(srcdir)/tests/system-userspace-testsuite
>  DISTCLEANFILES += tests/atconfig tests/atlocal
>
> -AUTOTEST_PATH = 
> ovs/utilities:ovs/vswitchd:ovs/ovsdb:ovs/vtep:tests:$(PTHREAD_WIN32_DIR_DLL):$(SSL_DIR):controller-vtep:northd:utilities:controller
> +AUTOTEST_PATH = 
> $(ovs_builddir)/utilities:$(ovs_builddir)/vswitchd:$(ovs_builddir)/ovsdb:$(ovs_builddir)/vtep:tests:$(PTHREAD_WIN32_DIR_DLL):$(SSL_DIR):controller-vtep:northd:utilities:controller
>
>  check-local:
>         set $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH); \
> --
> 2.21.0
>
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Acked-By: Lucas Alvares Gomes <[email protected]>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to