summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pkg/CMakeLists.txt24
-rw-r--r--src/pkg/debian/control.in (renamed from src/pkg/debian/control)4
-rwxr-xr-xsrc/pkg/debian/rules.in13
-rw-r--r--src/vpp-api/python/CMakeLists.txt6
4 files changed, 37 insertions, 10 deletions
diff --git a/src/pkg/CMakeLists.txt b/src/pkg/CMakeLists.txt
index 357d966ddee..a5a0ffe5827 100644
--- a/src/pkg/CMakeLists.txt
+++ b/src/pkg/CMakeLists.txt
@@ -20,14 +20,34 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE
)
-foreach(f rules changelog)
+# parse /etc/os-release
+file(READ "/etc/os-release" os_release)
+string(REPLACE "\n" ";" os_release ${os_release})
+foreach(l ${os_release})
+ string(REPLACE "=" ";" l ${l})
+ list(GET l 0 _name)
+ list(GET l 1 _value)
+ string(REPLACE "\"" "" _value ${_value})
+ set(OS_${_name} ${_value})
+endforeach()
+
+if (OS_ID STREQUAL "ubuntu" AND OS_VERSION_ID VERSION_LESS 20.04)
+ set(VPP_DEB_BUILD_DEPENDS "python-all, python3-all, python3-setuptools")
+ set(VPP_DEB_WITH_PYTHON2 "yes")
+else()
+ set(VPP_DEB_BUILD_DEPENDS "python3-all, python3-setuptools")
+ set(VPP_DEB_WITH_PYTHON2 "no")
+endif()
+
+foreach(f rules changelog control)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/debian/${f}.in
${CMAKE_BINARY_DIR}/debian/${f}
+ @ONLY
)
endforeach()
-foreach(f control copyright vpp.preinst vpp.postrm vpp.postinst vpp.service)
+foreach(f copyright vpp.preinst vpp.postrm vpp.postinst vpp.service)
file(COPY
${CMAKE_CURRENT_SOURCE_DIR}/debian/${f}
DESTINATION ${CMAKE_BINARY_DIR}/debian
diff --git a/src/pkg/debian/control b/src/pkg/debian/control.in
index 48de48ab115..0b0c621e50c 100644
--- a/src/pkg/debian/control
+++ b/src/pkg/debian/control.in
@@ -5,9 +5,7 @@ Maintainer: fd.io VPP Packaging Team <vpp-dev@fd.io>
Build-Depends: debhelper (>= 9),
dh-systemd,
dh-python,
- python-all,
- python3-all,
- python3-setuptools
+ @VPP_DEB_BUILD_DEPENDS@
Standards-Version: 3.9.4
Package: vpp
diff --git a/src/pkg/debian/rules.in b/src/pkg/debian/rules.in
index ceef46a297a..f09db38e2a1 100755
--- a/src/pkg/debian/rules.in
+++ b/src/pkg/debian/rules.in
@@ -9,18 +9,23 @@ include /usr/share/dpkg/default.mk
export PYBUILD_NAME = vpp-api
export PYBUILD_DIR = @CMAKE_SOURCE_DIR@/vpp-api/python
-export PYBUILD_DESTDIR_python2=debian/vpp-api-python/
-export PYBUILD_DISABLE_python2=test
export PYBUILD_DESTDIR_python3=debian/python3-vpp-api/
export PYBUILD_DISABLE_python3=test
export PYBUILD_SYSTEM=distutils
-
+ifeq (@VPP_DEB_WITH_PYTHON2@,yes)
+export PYBUILD_DESTDIR_python2=debian/vpp-api-python/
+export PYBUILD_DISABLE_python2=test
buildvers := $(shell pyversions -sv)
+DH_WITH = systemd,python2,python3
+else
+DH_WITH = systemd,python3
+endif
+
build3vers := $(shell py3versions -sv)
# main packaging script based on dh7 syntax
%:
- dh $@ --with systemd,python2,python3 --buildsystem=pybuild
+ dh $@ --with $(DH_WITH) --buildsystem=pybuild
override_dh_strip:
dh_strip --dbg-package=vpp-dbg
diff --git a/src/vpp-api/python/CMakeLists.txt b/src/vpp-api/python/CMakeLists.txt
index 910df6bfd6b..6450fd92f2d 100644
--- a/src/vpp-api/python/CMakeLists.txt
+++ b/src/vpp-api/python/CMakeLists.txt
@@ -11,7 +11,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-find_package(Python3 COMPONENTS Interpreter)
+if (CMAKE_VERSION VERSION_LESS 3.12)
+ find_package(PythonInterp 2.7)
+else()
+ find_package(Python3 COMPONENTS Interpreter)
+endif()
if(PYTHONINTERP_FOUND)
install(
{ color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 * Copyright (c) 2016 Cisco and/or its affiliates.
 * 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.
 */

#undef BIHASH_TYPE

#define BIHASH_TYPE _48_8
#define BIHASH_KVP_PER_PAGE 4

#ifndef __included_bihash_48_8_h__
#define __included_bihash_48_8_h__

#include <vppinfra/heap.h>
#include <vppinfra/format.h>
#include <vppinfra/pool.h>
#include <vppinfra/xxhash.h>

typedef struct
{
  u64 key[6];
  u64 value;
} clib_bihash_kv_48_8_t;

static inline int
clib_bihash_is_free_48_8 (const clib_bihash_kv_48_8_t * v)
{
  /* Free values are memset to 0xff, check a bit... */
  if (v->key[0] == ~0ULL && v->value == ~0ULL)
    return 1;
  return 0;
}

#if __SSE4_2__
#ifndef __defined_crc_u32__
#define __defined_crc_u32__
static inline u32
crc_u32 (u32 data, u32 value)
{
  __asm__ volatile ("crc32l %[data], %[value];":[value] "+r" (value):[data]
		    "rm" (data));
  return value;
}
#endif /* __defined_crc_u32__ */

static inline u64
clib_bihash_hash_48_8 (const clib_bihash_kv_48_8_t * v)
{
  const u32 *dp = (const u32 *) &v->key[0];
  u32 value = 0;

  value = crc_u32 (dp[0], value);
  value = crc_u32 (dp[1], value);
  value = crc_u32 (dp[2], value);
  value = crc_u32 (dp[3], value);
  value = crc_u32 (dp[4], value);
  value = crc_u32 (dp[5], value);
  value = crc_u32 (dp[6], value);
  value = crc_u32 (dp[7], value);
  value = crc_u32 (dp[8], value);
  value = crc_u32 (dp[9], value);
  value = crc_u32 (dp[10], value);
  value = crc_u32 (dp[11], value);

  return value;
}
#else
static inline u64
clib_bihash_hash_48_8 (const clib_bihash_kv_48_8_t * v)
{
  u64 tmp = v->key[0] ^ v->key[1] ^ v->key[2] ^ v->key[3] ^ v->key[4]
    ^ v->key[5];
  return clib_xxhash (tmp);
}
#endif

static inline u8 *
format_bihash_kvp_48_8 (u8 * s, va_list * args)
{
  clib_bihash_kv_48_8_t *v = va_arg (*args, clib_bihash_kv_48_8_t *);

  s = format (s, "key %llu %llu %llu %llu %llu %llu value %llu", v->key[0],
	      v->key[1], v->key[2], v->key[3], v->key[4], v->key[5],
	      v->value);
  return s;
}

static inline int
clib_bihash_key_compare_48_8 (const u64 * a, const u64 * b)
{
  return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2]) | (a[3] ^ b[3])
	  | (a[4] ^ b[4]) | (a[5] ^ b[5])) == 0;
}

#undef __included_bihash_template_h__
#include <vppinfra/bihash_template.h>

#endif /* __included_bihash_48_8_h__ */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */