diff --git a/Makefile.am b/Makefile.am index 653c4091..4cfea830 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,55 +8,65 @@ # if WANT_DOCS - DOCS = doc + DOCS = doc endif + if WANT_GUI - GUI = gui + GUI = gui endif + if WANT_DAEMON - DAEMON = scripts daemon + DAEMON = scripts daemon endif + if WANT_NETNS - NETNS = netns ns3 + NETNS = netns ns3 endif # keep docs last due to dependencies on binaries -SUBDIRS = ${GUI} ${DAEMON} ${DOCS} ${NETNS} +SUBDIRS = $(GUI) $(DAEMON) $(NETNS) $(DOCS) -ACLOCAL_AMFLAGS = -I config +ACLOCAL_AMFLAGS = -I config # extra files to include with distribution tarball -EXTRA_DIST = bootstrap.sh LICENSE \ - README.md ASSIGNMENT_OF_COPYRIGHT.pdf \ - Changelog \ - python-prefix.py revision.sh \ - .version .version.date +EXTRA_DIST = bootstrap.sh \ + LICENSE \ + README.md \ + ASSIGNMENT_OF_COPYRIGHT.pdf \ + Changelog \ + python-prefix.py \ + revision.sh \ + .version \ + .version.date -DISTCLEAN_TARGETS = aclocal.m4 config.h.in +DISTCLEAN_TARGETS = aclocal.m4 config.h.in # extra cruft to remove -DISTCLEANFILES = aclocal.m4 config.h.in configure Makefile.in config/compile +DISTCLEANFILES = aclocal.m4 \ + config.h.in \ + configure \ + Makefile.in \ + config/compile -MAINTAINERCLEANFILES = \ - .version \ - .version.date +MAINTAINERCLEANFILES = .version \ + .version.date define fpm-python = fpm -s python -t $1 \ - -m "$(CORE_MAINTAINERS)" \ - --vendor "$(CORE_VENDOR)" \ + -m "$(PACKAGE_MAINTAINERS)" \ + --vendor "$(PACKAGE_VENDOR)" \ $2 endef define fpm-gui = fpm -s dir -t $1 -n core-gui \ - -m "$(CORE_MAINTAINERS)" \ + -m "$(PACKAGE_MAINTAINERS)" \ --license "BSD" \ --description "Common Open Research Emulator GUI front-end" \ --url http://www.nrl.navy.mil/itd/ncs/products/core \ - --vendor "$(CORE_VENDOR)" \ + --vendor "$(PACKAGE_VENDOR)" \ -p core-gui_VERSION_ARCH.$1 \ - -v $(CORE_VERSION) \ + -v $(PACKAGE_VERSION) \ -d "bash" \ -d "tcl" \ -d "tk" \ @@ -66,10 +76,13 @@ endef define fpm-daemon-rpm = fpm -s python -t rpm \ - -p NAME_$1_VERSION_ARCH.rpm \ - --python-setup-py-arguments --service=$1 \ - -m "$(CORE_MAINTAINERS)" \ - --vendor "$(CORE_VENDOR)" \ + -p NAME_sysv_VERSION_ARCH.rpm \ + --rpm-init scripts/core-daemon \ + --python-install-bin $(bindir) \ + --python-install-data $(prefix) \ + --python-install-lib $(pythondir) \ + -m "$(PACKAGE_MAINTAINERS)" \ + --vendor "$(PACKAGE_VENDOR)" \ -d "procps-ng" \ -d "bash >= 3.0" \ -d "bridge-utils" \ @@ -84,9 +97,12 @@ endef define fpm-daemon-deb = fpm -s python -t deb \ -p NAME_$1_VERSION_ARCH.deb \ - --python-setup-py-arguments --service=$1 \ - -m "$(CORE_MAINTAINERS)" \ - --vendor "$(CORE_VENDOR)" \ + --python-install-bin $(bindir) \ + --python-install-data $(prefix) \ + --python-install-lib $(pythondir) \ + $2 $3 \ + -m "$(PACKAGE_MAINTAINERS)" \ + --vendor "$(PACKAGE_VENDOR)" \ -d "procps" \ -d "libc6 >= 2.14" \ -d "bash >= 3.0" \ @@ -106,27 +122,51 @@ fpm: clean-local-fpm $(call fpm-gui,deb,-d "libtk-img") $(call fpm-python,rpm,ns3/setup.py) $(call fpm-python,deb,ns3/setup.py) - $(call fpm-daemon-rpm,systemd) - $(call fpm-daemon-rpm,sysv) - $(call fpm-daemon-deb,systemd) - $(call fpm-daemon-deb,sysv) + $(call fpm-daemon-rpm) + $(call fpm-daemon-deb,sysv,--deb-init,scripts/core-daemon) + $(call fpm-daemon-deb,systemd,--deb-systemd,scripts/core-daemon.service) .PHONY: clean-local-fpm clean-local-fpm: -rm -rf *.deb -rm -rf *.rpm -.PHONY: core-restart -core-restart: - /etc/init.d/core-daemon stop - daemon/sbin/core-cleanup - rm -f /var/log/core-daemon.log - /etc/init.d/core-daemon start - clean-local: clean-local-fpm .version: Makefile - echo $(CORE_VERSION) > $@ + echo $(PACKAGE_VERSION) > $@ .version.date: Makefile - echo $(CORE_VERSION_DATE) > $@ + echo $(PACKAGE_DATE) > $@ + +define change-files = +$(info creating file $1 from $1.in) +@$(SED) -e 's,[@]sbindir[@],$(sbindir),g' \ + -e 's,[@]bindir[@],$(bindir),g' \ + -e 's,[@]PYTHON[@],$(PYTHON),g' \ + -e 's,[@]PACKAGE_VERSION[@],$(PACKAGE_VERSION),g' \ + -e 's,[@]PACKAGE_DATE[@],$(PACKAGE_DATE),g' \ + -e 's,[@]CORE_LIB_DIR[@],$(CORE_LIB_DIR),g' \ + -e 's,[@]CORE_STATE_DIR[@],$(CORE_STATE_DIR),g' \ + -e 's,[@]CORE_DATA_DIR[@],$(CORE_DATA_DIR),g' \ + -e 's,[@]CORE_CONF_DIR[@],$(CORE_CONF_DIR),g' \ + -e 's,[@]CORE_GUI_CONF_DIR[@],$(CORE_GUI_CONF_DIR),g' \ + -e 's,[@]brctl_path[@],$(brctl_path),g' \ + -e 's,[@]sysctl_path[@],$(sysctl_path),g' \ + -e 's,[@]ip_path[@],$(ip_path),g' \ + -e 's,[@]tc_path[@],$(tc_path),g' \ + -e 's,[@]ebtables_path[@],$(ebtables_path),g' \ + -e 's,[@]mount_path[@],$(mount_path),g' \ + -e 's,[@]umount_path[@],$(umount_path),g' \ + -e 's,[@]ovs_vs_path[@],$(ovs_vs_path),g' \ + -e 's,[@]ovs_of_path[@],$(ovs_of_path),g' \ + < $1.in > $1 +endef + +all: change-files + +.PHONY: change-files +change-files: + $(call change-files,gui/core-gui) + $(call change-files,scripts/core-daemon.service) + $(call change-files,daemon/core/constants.py) diff --git a/configure.ac b/configure.ac index 12d90cda..0ea864ea 100644 --- a/configure.ac +++ b/configure.ac @@ -9,82 +9,37 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -# # this defines the CORE version number, must be static for AC_INIT -# AC_INIT(core, 5.1, core-dev@nrl.navy.mil) -VERSION=$PACKAGE_VERSION -CORE_VERSION=$PACKAGE_VERSION -CORE_VERSION_DATE=m4_esyscmd_s([date +%Y%m%d]) -COREDPY_VERSION=$PACKAGE_VERSION -CORE_MAINTAINERS="CORE Developers " -CORE_VENDOR="CORE Developers" -# # autoconf and automake initialization -# AC_CONFIG_SRCDIR([netns/version.h.in]) AC_CONFIG_AUX_DIR(config) AC_CONFIG_MACRO_DIR(config) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([tar-ustar]) -AC_SUBST(CORE_VERSION) -AC_SUBST(CORE_VERSION_DATE) -AC_SUBST(COREDPY_VERSION) -AC_SUBST(CORE_MAINTAINERS) -AC_SUBST(CORE_VENDOR) +# define variables used for packaging and date display +PACKAGE_DATE=m4_esyscmd_s([date +%Y%m%d]) +PACKAGE_VENDOR="CORE Developers" +PACKAGE_MAINTAINERS="$PACKAGE_VENDOR <$PACKAGE_BUGREPORT>" +CORE_LIB_DIR="\${prefix}/lib/core" +# TODO: hard setting path, until support by setup.py +CORE_CONF_DIR="/etc/core" +CORE_DATA_DIR="\${datarootdir}/core" +# TODO: verify there is need to hard set /var +CORE_STATE_DIR="\${localstatedir}" -# -# some of the following directory variables are not expanded at configure-time, -# so we have special checks to expand them -# - -# CORE GUI files in LIBDIR -# AC_PREFIX_DEFAULT is /usr/local, but not expanded yet -if test "x$prefix" = "xNONE" ; then - prefix="/usr/local" -fi -if test "x$exec_prefix" = "xNONE" ; then - exec_prefix="$prefix" -fi -if test "$libdir" = "\${exec_prefix}/lib" ; then - libdir="${exec_prefix}/lib" -fi -if test "$sbindir" = "\${exec_prefix}/sbin" ; then - sbindir="${exec_prefix}/sbin" -fi -if test "$bindir" = "\${exec_prefix}/bin" ; then - bindir="${exec_prefix}/bin" -fi -# this can be /usr/lib or /usr/lib64 -LIB_DIR="${libdir}" -# don't let the Tcl files install to /usr/lib64/core -CORE_LIB_DIR="${prefix}/lib/core" -AC_SUBST(LIB_DIR) +AC_SUBST(PACKAGE_DATE) +AC_SUBST(PACKAGE_MAINTAINERS) +AC_SUBST(PACKAGE_VENDOR) AC_SUBST(CORE_LIB_DIR) -SBINDIR="${sbindir}" -AC_SUBST(SBINDIR) -BINDIR="${bindir}" -AC_SUBST(BINDIR) - -# CORE daemon configuration file (core.conf) in CORE_CONF_DIR -if test "$sysconfdir" = "\${prefix}/etc" ; then - sysconfdir="/etc" - CORE_CONF_DIR="/etc/core" -else - CORE_CONF_DIR="$sysconfdir/core" -fi AC_SUBST(CORE_CONF_DIR) -if test "$datarootdir" = "\${prefix}/share" ; then - datarootdir="${prefix}/share" -fi -CORE_DATA_DIR="$datarootdir/core" AC_SUBST(CORE_DATA_DIR) +AC_SUBST(CORE_STATE_DIR) # CORE GUI configuration files and preferences in CORE_GUI_CONF_DIR # scenario files in ~/.core/configs/ -#AC_ARG_VAR(CORE_GUI_CONF_DIR, [GUI configuration directory.]) AC_ARG_WITH([guiconfdir], [AS_HELP_STRING([--with-guiconfdir=dir], [specify GUI configuration directory])], @@ -102,91 +57,27 @@ AC_ARG_ENABLE([daemon], (default is yes)])], [], [enable_daemon=yes]) AC_SUBST(enable_daemon) -if test "x$enable_daemon" = "xno"; then - want_python=no - want_linux_netns=no -fi -# CORE state files -if test "$localstatedir" = "\${prefix}/var" ; then - # use /var instead of /usr/local/var (/usr/local/var/log isn't standard) - CORE_STATE_DIR="/var" -else - CORE_STATE_DIR="$localstatedir" -fi -AC_SUBST(CORE_STATE_DIR) +SEARCHPATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin" # default compiler flags # _GNU_SOURCE is defined to get c99 defines for lrint() CFLAGS="$CFLAGS -O3 -Werror -Wall -D_GNU_SOURCE" -# debug flags -#CFLAGS="$CFLAGS -g -Werror -Wall -D_GNU_SOURCE" -# Checks for programs. +# checks for programs AC_PROG_AWK AC_PROG_CC AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_RANLIB +AC_PROG_SED -AM_PATH_PYTHON(2.6, want_python=yes, want_python=no) -SEARCHPATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin" -# -# daemon dependencies -# -if test "x$enable_daemon" = "xyes" ; then - AC_CHECK_PROG(brctl_path, brctl, $as_dir, no, $SEARCHPATH) - AC_CHECK_PROG(sysctl_path, sysctl, $as_dir, no, $SEARCHPATH) - AC_CHECK_PROG(ebtables_path, ebtables, $as_dir, no, $SEARCHPATH) - AC_CHECK_PROG(ip_path, ip, $as_dir, no, $SEARCHPATH) - AC_CHECK_PROG(tc_path, tc, $as_dir, no, $SEARCHPATH) - AC_CHECK_PROG(ifconfig_path, ifconfig, $as_dir, no, $SEARCHPATH) - AC_CHECK_PROG(ngctl_path, ngctl, $as_dir, no, $SEARCHPATH) - AC_CHECK_PROG(vimage_path, vimage, $as_dir, no, $SEARCHPATH) - AC_CHECK_PROG(mount_path, mount, $as_dir, no, $SEARCHPATH) - AC_CHECK_PROG(umount_path, umount, $as_dir, no, $SEARCHPATH) - AC_CHECK_PROG(convert, convert, yes, no, $SEARCHPATH) - AC_CHECK_PROG(ovs_vs_path, ovs-vsctl, $as_dir, no, $SEARCHPATH) - AC_CHECK_PROG(ovs_of_path, ovs-ofctl, $as_dir, no, $SEARCHPATH) -fi +want_python=no +want_linux_netns=no +if test "x$enable_daemon" = "xyes"; then + want_python=yes + want_linux_netns=yes -#AC_CHECK_PROG(dia, dia, yes, no) -AC_CHECK_PROG(help2man, help2man, yes, no, $SEARCHPATH) -if test "x$convert" = "xno" ; then - AC_MSG_WARN([Could not locate ImageMagick convert.]) - #want_docs_missing="convert" -fi -#if test "x$dia" = "xno" ; then -# AC_MSG_WARN([Could not locate dia.]) -# want_docs_missing="dia" -#fi -if test "x$help2man" = "xno" ; then - AC_MSG_WARN([Could not locate help2man.]) - want_docs_missing="$want_docs_missing help2man" -fi -if test "x$want_docs_missing" = "x" ; then - want_docs=yes -else - AC_MSG_WARN([Could not find required helper utilities (${want_docs_missing}) so the CORE documentation will not be built.]) - want_docs=no -fi - -# check for sphinx required during make -AC_CHECK_PROG(sphinxapi_path, sphinx-apidoc, $as_dir, no, $SEARCHPATH) -if test "x$sphinxapi_path" = "xno" ; then - AC_MSG_ERROR(["Could not location sphinx-apidoc, from the python-sphinx package"]) -fi - -#AC_PATH_PROGS(tcl_path, [tclsh tclsh8.5 tclsh8.4], no) -#if test "x$tcl_path" = "xno" ; then -# AC_MSG_ERROR([Could not locate tclsh. Please install Tcl/Tk.]) -#fi -#AC_PATH_PROGS(wish_path, [wish wish8.5 wish8.4], no) -#if test "x$wish_path" = "xno" ; then -# AC_MSG_ERROR([Could not locate wish. Please install Tcl/Tk.]) -#fi - -if test "x$enable_daemon" = "xyes" ; then # Checks for libraries. AC_CHECK_LIB([netgraph], [NgMkSockNode]) @@ -207,73 +98,94 @@ if test "x$enable_daemon" = "xyes" ; then AC_FUNC_MALLOC AC_FUNC_REALLOC AC_CHECK_FUNCS([atexit dup2 gettimeofday memset socket strerror uname]) + + AM_PATH_PYTHON(2.6) + + AC_CHECK_PROG(brctl_path, brctl, $as_dir, no, $SEARCHPATH) + if test "x$brctl_path" = "xno" ; then + AC_MSG_ERROR([Could not locate brctl (from bridge-utils package).]) + fi + AC_CHECK_PROG(sysctl_path, sysctl, $as_dir, no, $SEARCHPATH) + AC_CHECK_PROG(ebtables_path, ebtables, $as_dir, no, $SEARCHPATH) + if test "x$ebtables_path" = "xno" ; then + AC_MSG_ERROR([Could not locate ebtables (from ebtables package).]) + fi + AC_CHECK_PROG(ip_path, ip, $as_dir, no, $SEARCHPATH) + if test "x$ip_path" = "xno" ; then + AC_MSG_ERROR([Could not locate ip (from iproute package).]) + fi + AC_CHECK_PROG(tc_path, tc, $as_dir, no, $SEARCHPATH) + if test "x$tc_path" = "xno" ; then + AC_MSG_ERROR([Could not locate tc (from iproute package).]) + fi + AC_CHECK_PROG(mount_path, mount, $as_dir, no, $SEARCHPATH) + AC_CHECK_PROG(umount_path, umount, $as_dir, no, $SEARCHPATH) + AC_CHECK_PROG(convert, convert, yes, no, $SEARCHPATH) + if test "x$convert" = "xno" ; then + AC_MSG_WARN([Could not locate ImageMagick convert.]) + fi + AC_CHECK_PROG(ovs_vs_path, ovs-vsctl, $as_dir, no, $SEARCHPATH) + if test "x$ovs_vs_path" = "xno" ; then + AC_MSG_WARN([Could not locate ovs-vsctl cannot use OVS nodes]) + fi + AC_CHECK_PROG(ovs_of_path, ovs-ofctl, $as_dir, no, $SEARCHPATH) + if test "x$ovs_of_path" = "xno" ; then + AC_MSG_WARN([Could not locate ovs-ofctl cannot use OVS nodes]) + fi + + CFLAGS_save=$CFLAGS + CPPFLAGS_save=$CPPFLAGS + if test "x$PYTHON_INCLUDE_DIR" = "x"; then + PYTHON_INCLUDE_DIR=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_python_inc()"` + fi + CFLAGS="-I$PYTHON_INCLUDE_DIR" + CPPFLAGS="-I$PYTHON_INCLUDE_DIR" + AC_CHECK_HEADERS([Python.h], [], + AC_MSG_ERROR([Python bindings require Python development headers (try installing your 'python-devel' or 'python-dev' package)])) + CFLAGS=$CFLAGS_save + CPPFLAGS=$CPPFLAGS_save + PKG_CHECK_MODULES(libev, libev, + AC_MSG_RESULT([found libev using pkgconfig OK]) + AC_SUBST(libev_CFLAGS) + AC_SUBST(libev_LIBS), + AC_MSG_RESULT([did not find libev using pkconfig...]) + AC_CHECK_LIB([ev], ev_set_allocator, + AC_MSG_RESULT([found libev OK]) + AC_SUBST(libev_CFLAGS) + AC_SUBST(libev_LIBS, [-lev]), + AC_MSG_ERROR([Python bindings require libev (try installing your 'libev-devel' or 'libev-dev' package)]))) fi -# Host-specific detection -want_linux_netns=yes +AC_CHECK_PROG(help2man, help2man, yes, no, $SEARCHPATH) -if test "x$want_python" = "xno"; then - want_linux_netns=no +if test "x$help2man" = "xno" ; then + AC_MSG_WARN([Could not locate help2man.]) + want_docs_missing="$want_docs_missing help2man" fi -if test "x$want_python" = "xyes"; then - if test "x$want_linux_netns" = "xyes"; then - CFLAGS_save=$CFLAGS - CPPFLAGS_save=$CPPFLAGS - if test "x$PYTHON_INCLUDE_DIR" = "x"; then - PYTHON_INCLUDE_DIR=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_python_inc()"` - fi - CFLAGS="-I$PYTHON_INCLUDE_DIR" - CPPFLAGS="-I$PYTHON_INCLUDE_DIR" - AC_CHECK_HEADERS([Python.h], [], - AC_MSG_ERROR([Python bindings require Python development headers (try installing your 'python-devel' or 'python-dev' package)])) - CFLAGS=$CFLAGS_save - CPPFLAGS=$CPPFLAGS_save - PKG_CHECK_MODULES(libev, libev, - AC_MSG_RESULT([found libev using pkgconfig OK]) - AC_SUBST(libev_CFLAGS) - AC_SUBST(libev_LIBS), - AC_MSG_RESULT([did not find libev using pkconfig...]) - AC_CHECK_LIB([ev], ev_set_allocator, - AC_MSG_RESULT([found libev OK]) - AC_SUBST(libev_CFLAGS) - AC_SUBST(libev_LIBS, [-lev]), - AC_MSG_ERROR([Python bindings require libev (try installing your 'libev-devel' or 'libev-dev' package)]))) - fi - AC_SUBST(pyprefix, `eval ${PYTHON} ./python-prefix.py ${PYTHON_PREFIX} ${PYTHON_VERSION}`) - if test "${pyprefix}" != "${PYTHON_PREFIX}"; then - pythondir=`echo ${pythondir} | sed -e 's,[$][{]prefix[}],${pyprefix},g'` - pyexecdir=`echo ${pyexecdir} | sed -e 's,[$][{]exec_prefix[}],${pyprefix},g'` - fi +if test "x$want_docs_missing" = "x" ; then + want_docs=yes else - # Namespace support requires Python support - want_linux_netns=no + AC_MSG_WARN([Could not find required helper utilities (${want_docs_missing}) so the CORE documentation will not be built.]) + want_docs=no fi -progs_missing="" -if test "x$want_linux_netns" = "xyes"; then - if test "x$brctl_path" = "xno" ; then - progs_missing="${progs_missing}brctl " - brctl_path="/usr/sbin" - AC_MSG_ERROR([Could not locate brctl (from bridge-utils package).]) - fi - if test "x$ebtables_path" = "xno" ; then - progs_missing="${progs_missing}ebtables " - ebtables_path="/sbin" - AC_MSG_ERROR([Could not locate ebtables (from ebtables package).]) - fi - if test "x$ip_path" = "xno" ; then - progs_missing="${progs_missing}ip " - ip_path="/sbin" - AC_MSG_ERROR([Could not locate ip (from iproute package).]) - fi - if test "x$tc_path" = "xno" ; then - progs_missing="${progs_missing}tc " - tc_path="/sbin" - AC_MSG_ERROR([Could not locate tc (from iproute package).]) - fi +# check for sphinx required during make +AC_CHECK_PROG(sphinxapi_path, sphinx-apidoc, $as_dir, no, $SEARCHPATH) +if test "x$sphinxapi_path" = "xno" ; then + AC_MSG_ERROR(["Could not location sphinx-apidoc, from the python-sphinx package"]) fi +#AC_PATH_PROGS(tcl_path, [tclsh tclsh8.5 tclsh8.4], no) +#if test "x$tcl_path" = "xno" ; then +# AC_MSG_ERROR([Could not locate tclsh. Please install Tcl/Tk.]) +#fi + +#AC_PATH_PROGS(wish_path, [wish wish8.5 wish8.4], no) +#if test "x$wish_path" = "xno" ; then +# AC_MSG_ERROR([Could not locate wish. Please install Tcl/Tk.]) +#fi + AC_ARG_WITH([startup], [AS_HELP_STRING([--with-startup=option], [option=systemd,suse,none to install systemd/SUSE init scripts])], @@ -288,7 +200,6 @@ AM_CONDITIONAL(WANT_DAEMON, test x$enable_daemon = xyes) AM_CONDITIONAL(WANT_DOCS, test x$want_docs = xyes) AM_CONDITIONAL(WANT_PYTHON, test x$want_python = xyes) AM_CONDITIONAL(WANT_NETNS, test x$want_linux_netns = xyes) - AM_CONDITIONAL(WANT_INITD, test x$with_startup = xinitd) AM_CONDITIONAL(WANT_SYSTEMD, test x$with_startup = xsystemd) AM_CONDITIONAL(WANT_SUSE, test x$with_startup = xsuse) @@ -299,28 +210,26 @@ else HELP2MAN=: fi - # Output files +#gui/core-gui +#scripts/core-daemon.service +#daemon/core/constants.py AC_CONFIG_FILES([Makefile - gui/core-gui gui/version.tcl gui/Makefile gui/icons/Makefile scripts/Makefile - scripts/core-daemon.service scripts/perf/Makefile doc/Makefile doc/conf.py doc/man/Makefile doc/figures/Makefile daemon/Makefile - daemon/core/constants.py daemon/doc/Makefile daemon/doc/conf.py netns/Makefile netns/version.h - ns3/Makefile - ns3/corens3/constants.py],) + ns3/Makefile],) AC_OUTPUT # Summary text @@ -331,12 +240,12 @@ ${PACKAGE_STRING} Configuration: Host System Type: ${host} C Compiler and flags: ${CC} ${CFLAGS} Install prefix: ${prefix} + Exec prefix: ${exec_prefix} Build GUI: ${enable_gui} GUI path: ${CORE_LIB_DIR} GUI config: ${CORE_GUI_CONF_DIR} - Daemon path: ${SBINDIR} + Daemon path: ${sbindir} Daemon config: ${CORE_CONF_DIR} - Python install prefix: ${pyprefix} Python modules: ${pythondir} Logs: ${CORE_STATE_DIR}/log @@ -352,8 +261,3 @@ if test "x${want_linux_netns}" = "xyes" ; then ------------------------------------------------------------------------" fi -if test "x${progs_missing}" != "x" ; then - echo ">>> NOTE: the following programs could not be found:" - echo " $progs_missing -------------------------------------------------------------------------" -fi diff --git a/daemon/MANIFEST.in b/daemon/MANIFEST.in deleted file mode 100644 index f5aa698b..00000000 --- a/daemon/MANIFEST.in +++ /dev/null @@ -1,4 +0,0 @@ -recursive-include sbin *.sh *.py -include data/core.conf -recursive-include examples/netns *.py *.sh -recursive-exclude examples/netns *.pyc *.pyo diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 20ba8b36..24c07196 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -7,73 +7,17 @@ # Makefile for building netns components. # -SETUPPY = setup.py -SETUPPYFLAGS = -v +SETUPPY = setup.py +SETUPPYFLAGS = -v if WANT_DOCS SUBDIRS = doc endif -SBIN_FILES = \ - sbin/core-cleanup \ - sbin/core-daemon \ - sbin/core-manage \ - sbin/coresendmsg +SCRIPT_FILES := $(notdir $(wildcard sbin/*)) +MAN_FILES := $(notdir $(wildcard ../doc/man/*.1)) -dist_sbin_SCRIPTS = $(SBIN_FILES) - -CONF_FILES = \ - data/core.conf - -coreconfdir = $(CORE_CONF_DIR) -dist_coreconf_DATA = $(CONF_FILES) - -EXAMPLE_FILES = \ - examples/controlnet_updown \ - examples/emanemanifest2core.py \ - examples/emanemodel2core.py \ - examples/findcore.py \ - examples/stopsession.py - -coreexdir = $(datadir)/core/examples -dist_coreex_SCRIPTS = $(EXAMPLE_FILES) - -EXAMPLE_MYSERVICES_FILES = \ - examples/myservices/README.txt \ - examples/myservices/__init__.py \ - examples/myservices/sample.py - -coreexmyservicesdir = $(coreexdir)/myservices -dist_coreexmyservices_DATA = $(EXAMPLE_MYSERVICES_FILES) - -EXAMPLE_NETNS_FILES = \ - examples/netns/basicrange.py \ - examples/netns/daemonnodes.py \ - examples/netns/distributed.py \ - examples/netns/emane80211.py \ - examples/netns/howmanynodes.py \ - examples/netns/iperf-performance-chain.py \ - examples/netns/iperf-performance.sh \ - examples/netns/ospfmanetmdrtest.py \ - examples/netns/switch.py \ - examples/netns/switchtest.py \ - examples/netns/twonodes.sh \ - examples/netns/wlanemanetests.py \ - examples/netns/wlantest.py - -coreexnetnsdir = $(coreexdir)/netns -dist_coreexnetns_SCRIPTS= $(EXAMPLE_NETNS_FILES) - -EXAMPLE_SERVICES_FILES = \ - examples/services/sampleFirewall \ - examples/services/sampleIPsec \ - examples/services/sampleVPNClient \ - examples/services/sampleVPNServer - -coreexservicesdir = $(coreexdir)/services -dist_coreexservices_DATA= $(EXAMPLE_SERVICES_FILES) - -LOGROTATE_DIR = $(sysconfdir)/logrotate.d +LOGROTATE_DIR = $(DESTDIR)/$(sysconfdir)/logrotate.d LOGROTATE_FILE = data/core-daemon.logrotate # Python package build @@ -83,47 +27,40 @@ build: # Python package install install-exec-hook: - $(MKDIR_P) ${DESTDIR}/${pythondir} - $(MKDIR_P) ${DESTDIR}/${pyexecdir} - PYTHONPATH=${DESTDIR}/${pythondir} $(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) install \ - --prefix=${DESTDIR}/${pyprefix} \ - --install-purelib=${DESTDIR}/${pythondir} \ - --install-platlib=${DESTDIR}/${pyexecdir} + $(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) install \ + --root=/$(DESTDIR) \ + --prefix=$(prefix) \ + --install-lib=$(pythondir) \ + --single-version-externally-managed -install-data-local: - $(MKDIR_P) $(DESTDIR)$(LOGROTATE_DIR) - $(INSTALL_DATA) $(LOGROTATE_FILE) \ - $(DESTDIR)$(LOGROTATE_DIR)/`basename $(LOGROTATE_FILE) .logrotate` +#install-data-local: +# $(MKDIR_P) $(DESTDIR)$(LOGROTATE_DIR) +# $(INSTALL_DATA) $(LOGROTATE_FILE) \ +# $(DESTDIR)$(LOGROTATE_DIR)/`basename $(LOGROTATE_FILE) .logrotate` -uninstall-local: - rm -f $(DESTDIR)$(LOGROTATE_DIR)/`basename $(LOGROTATE_FILE) .logrotate` +#uninstall-local: +# rm -f $(DESTDIR)$(LOGROTATE_DIR)/`basename $(LOGROTATE_FILE) .logrotate` # Python package uninstall +#rmdir -p $(LOGROTATE_DIR) || true uninstall-hook: - rm -rf ${pythondir}/core_python-${COREDPY_VERSION}-py${PYTHON_VERSION}.egg-info - rm -f ${pythondir}/core_python_netns-1.0-py${PYTHON_VERSION}.egg-info - rm -rf ${pythondir}/core - rmdir -p $(coreexservicesdir) || true - rmdir -p $(coreexnetnsdir) || true - rmdir -p $(coreexmyservicesdir) || true - rmdir -p $(coreexdir) || true - rmdir -p $(coreconfdir) || true - rmdir -p $(LOGROTATE_DIR) || true + rm -rf $(DESTDIR)/etc/core + rm -rf $(DESTDIR)/$(datadir)/core + rm -f $(addprefix $(DESTDIR)/$(datadir)/man/man1/, $(MAN_FILES)) + rm -f $(addprefix $(DESTDIR)/$(bindir)/,$(SCRIPT_FILES)) + rm -rf $(DESTDIR)/$(pythondir)/core-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg-info + rm -rf $(DESTDIR)/$(pythondir)/core # Python package cleanup clean-local: -rm -rf build -# Python RPM package -rpm: - $(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) bdist_rpm - # because we include entire directories with EXTRA_DIST, we need to clean up # the source control files dist-hook: - rm -rf `find $(distdir)/ -name .svn` `find $(distdir)/ -name '*.pyc'` + rm -rf `find $(distdir)/ -name '*.pyc'` DISTCLEANFILES = Makefile.in core/*.pyc MANIFEST # files to include with distribution tarball -EXTRA_DIST = $(SETUPPY) MANIFEST.in core doc $(LOGROTATE_FILE) +EXTRA_DIST = $(SETUPPY) MANIFEST.in core doc $(LOGROTATE_FILE) diff --git a/daemon/core/constants.py.in b/daemon/core/constants.py.in index 1e5db2b6..7dea1ad8 100644 --- a/daemon/core/constants.py.in +++ b/daemon/core/constants.py.in @@ -1,22 +1,18 @@ -# Constants created by autoconf ./configure script -COREDPY_VERSION = "@COREDPY_VERSION@" -CORE_STATE_DIR = "@CORE_STATE_DIR@" -CORE_CONF_DIR = "@CORE_CONF_DIR@" -CORE_DATA_DIR = "@CORE_DATA_DIR@" -CORE_LIB_DIR = "@CORE_LIB_DIR@" -CORE_SBIN_DIR = "@SBINDIR@" -CORE_BIN_DIR = "@BINDIR@" +COREDPY_VERSION = "@PACKAGE_VERSION@" +CORE_STATE_DIR = "@CORE_STATE_DIR@" +CORE_CONF_DIR = "@CORE_CONF_DIR@" +CORE_DATA_DIR = "@CORE_DATA_DIR@" +CORE_LIB_DIR = "@CORE_LIB_DIR@" -BRCTL_BIN = "@brctl_path@/brctl" -SYSCTL_BIN = "@sysctl_path@/sysctl" -IP_BIN = "@ip_path@/ip" -TC_BIN = "@tc_path@/tc" -EBTABLES_BIN = "@ebtables_path@/ebtables" -IFCONFIG_BIN = "@ifconfig_path@/ifconfig" -NGCTL_BIN = "@ngctl_path@/ngctl" -VIMAGE_BIN = "@vimage_path@/vimage" -QUAGGA_STATE_DIR = "@CORE_STATE_DIR@/run/quagga" -MOUNT_BIN = "@mount_path@/mount" -UMOUNT_BIN = "@umount_path@/umount" -OVS_BIN = "@ovs_vs_path@/ovs-vsctl" -OVS_FLOW_BIN = "@ovs_of_path@/ovs-ofctl" +VNODED_BIN = "@bindir@/vnoded" +VCMD_BIN = "@bindir@/vcmd" +BRCTL_BIN = "@brctl_path@/brctl" +SYSCTL_BIN = "@sysctl_path@/sysctl" +IP_BIN = "@ip_path@/ip" +TC_BIN = "@tc_path@/tc" +EBTABLES_BIN = "@ebtables_path@/ebtables" +QUAGGA_STATE_DIR = "@CORE_STATE_DIR@/run/quagga" +MOUNT_BIN = "@mount_path@/mount" +UMOUNT_BIN = "@umount_path@/umount" +OVS_BIN = "@ovs_vs_path@/ovs-vsctl" +OVS_FLOW_BIN = "@ovs_of_path@/ovs-ofctl" diff --git a/daemon/core/netns/vnode.py b/daemon/core/netns/vnode.py index 987fdac5..e11c75d3 100644 --- a/daemon/core/netns/vnode.py +++ b/daemon/core/netns/vnode.py @@ -86,7 +86,7 @@ class SimpleLxcNode(PyCoreNode): # create a new namespace for this node using vnoded vnoded = [ - "%s/vnoded" % constants.CORE_BIN_DIR, + constants.VNODED_BIN, "-v", "-c", self.ctrlchnlname, "-l", self.ctrlchnlname + ".log", diff --git a/daemon/core/netns/vnodeclient.py b/daemon/core/netns/vnodeclient.py index 5d5ebea0..5d05d955 100644 --- a/daemon/core/netns/vnodeclient.py +++ b/daemon/core/netns/vnodeclient.py @@ -14,8 +14,6 @@ from core import constants from core import logger from core.misc import utils -VCMD = os.path.join(constants.CORE_BIN_DIR, "vcmd") - class VnodeClient(object): """ @@ -134,7 +132,7 @@ class VnodeClient(object): :rtype: int """ args = utils.split_args(args) - return os.spawnlp(os.P_WAIT, VCMD, VCMD, "-c", self.ctrlchnlname, "--", *args) + return os.spawnlp(os.P_WAIT, constants.VCMD_BIN, constants.VCMD_BIN, "-c", self.ctrlchnlname, "--", *args) def redircmd(self, infd, outfd, errfd, args, wait=True): """ @@ -171,7 +169,7 @@ class VnodeClient(object): :return: terminal command result :rtype: int """ - args = ("xterm", "-ut", "-title", self.name, "-e", VCMD, "-c", self.ctrlchnlname, "--", sh) + args = ("xterm", "-ut", "-title", self.name, "-e", constants.VCMD_BIN, "-c", self.ctrlchnlname, "--", sh) if "SUDO_USER" in os.environ: args = ("su", "-s", "/bin/sh", "-c", "exec " + " ".join(map(lambda x: "'%s'" % x, args)), @@ -185,7 +183,7 @@ class VnodeClient(object): :param str sh: shell to execute command in :return: str """ - return "%s -c %s -- %s" % (VCMD, self.ctrlchnlname, sh) + return "%s -c %s -- %s" % (constants.VCMD_BIN, self.ctrlchnlname, sh) def shcmd(self, cmd, sh="/bin/sh"): """ diff --git a/daemon/doc/conf.py.in b/daemon/doc/conf.py.in index 7b44569f..c9041fae 100644 --- a/daemon/doc/conf.py.in +++ b/daemon/doc/conf.py.in @@ -49,9 +49,9 @@ copyright = u'2017, core-dev' # built documents. # # The short X.Y version. -version = '@CORE_VERSION@' +version = '@PACKAGE_VERSION@' # The full version, including alpha/beta/rc tags. -release = '@CORE_VERSION@' +release = '@PACKAGE_VERSION@' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/daemon/setup.py b/daemon/setup.py index 35769399..2783af42 100644 --- a/daemon/setup.py +++ b/daemon/setup.py @@ -4,13 +4,13 @@ Defines how CORE will be built for installation. import glob import os -from distutils.command.install import install -from setuptools import setup, find_packages +from setuptools import find_packages +from distutils.core import setup _CORE_DIR = "/etc/core" -_MAN_DIR = "/usr/local/share/man/man1" -_SHARE_DIR = "/usr/local/share/core" +_MAN_DIR = "share/man/man1" +_EXAMPLES_DIR = "share/core" _SYSV = "/etc/init.d" _SYSTEMD = "/etc/systemd/system" @@ -30,31 +30,6 @@ def glob_files(glob_path): return glob.glob(glob_path) -class CustomInstall(install): - user_options = install.user_options + [ - ("service=", None, "determine which service file to include") - ] - - def initialize_options(self): - install.initialize_options(self) - self.service = "sysv" - - def finalize_options(self): - install.finalize_options(self) - assert self.service in ("sysv", "systemd"), "must be sysv or systemd" - - def run(self): - if self.service == "sysv": - self.distribution.data_files.append(( - _SYSV, ["../scripts/core-daemon"] - )) - else: - self.distribution.data_files.append(( - _SYSTEMD, ["../scripts/core-daemon.service"] - )) - install.run(self) - - data_files = [ (_CORE_DIR, [ "data/core.conf", @@ -62,7 +37,7 @@ data_files = [ ]), (_MAN_DIR, glob_files("../doc/man/**.1")), ] -data_files.extend(recursive_files(_SHARE_DIR, "examples")) +data_files.extend(recursive_files(_EXAMPLES_DIR, "examples")) setup( name="core", @@ -90,7 +65,4 @@ setup( author_email="core-dev@nrl.navy.mil", license="BSD", long_description="Python scripts and modules for building virtual emulated networks.", - cmdclass={ - "install": CustomInstall - } ) diff --git a/doc/conf.py.in b/doc/conf.py.in index 34655128..210c372f 100644 --- a/doc/conf.py.in +++ b/doc/conf.py.in @@ -49,9 +49,9 @@ copyright = u'2017, core-dev' # built documents. # # The short X.Y version. -version = '@CORE_VERSION@' +version = '@PACKAGE_VERSION@' # The full version, including alpha/beta/rc tags. -release = '@CORE_VERSION@' +release = '@PACKAGE_VERSION@' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am index f76eee84..8479faaa 100644 --- a/doc/man/Makefile.am +++ b/doc/man/Makefile.am @@ -22,10 +22,10 @@ generate-mans: $(HELP2MAN) --no-info --source CORE $(top_srcdir)/netns/vnoded -o vnoded.1.new $(HELP2MAN) --no-info --source CORE $(top_srcdir)/netns/vcmd -o vcmd.1.new $(HELP2MAN) --no-info --source CORE $(top_srcdir)/netns/netns -o netns.1.new - $(HELP2MAN) --version-string=$(CORE_VERSION) --no-info --source CORE $(top_srcdir)/daemon/sbin/core-daemon -o core-daemon.1.new - $(HELP2MAN) --version-string=$(CORE_VERSION) --no-info --source CORE $(top_srcdir)/daemon/sbin/coresendmsg -o coresendmsg.1.new - $(HELP2MAN) --version-string=$(CORE_VERSION) --no-info --source CORE $(top_srcdir)/daemon/sbin/core-cleanup -o core-cleanup.1.new - $(HELP2MAN) --version-string=$(CORE_VERSION) --no-info --source CORE $(top_srcdir)/daemon/sbin/core-manage -o core-manage.1.new + $(HELP2MAN) --version-string=$(PACKAGE_VERSION) --no-info --source CORE $(top_srcdir)/daemon/sbin/core-daemon -o core-daemon.1.new + $(HELP2MAN) --version-string=$(PACKAGE_VERSION) --no-info --source CORE $(top_srcdir)/daemon/sbin/coresendmsg -o coresendmsg.1.new + $(HELP2MAN) --version-string=$(PACKAGE_VERSION) --no-info --source CORE $(top_srcdir)/daemon/sbin/core-cleanup -o core-cleanup.1.new + $(HELP2MAN) --version-string=$(PACKAGE_VERSION) --no-info --source CORE $(top_srcdir)/daemon/sbin/core-manage -o core-manage.1.new .PHONY: diff diff: diff --git a/gui/Makefile.am b/gui/Makefile.am index 65cf085b..3a1a09d0 100644 --- a/gui/Makefile.am +++ b/gui/Makefile.am @@ -10,63 +10,28 @@ SUBDIRS = icons -TCL_FILES = annotations.tcl api.tcl canvas.tcl cfgparse.tcl \ - core.tcl debug.tcl editor.tcl exec.tcl \ - filemgmt.tcl gpgui.tcl \ - graph_partitioning.tcl help.tcl \ - initgui.tcl ipv4.tcl ipv6.tcl \ - linkcfg.tcl mobility.tcl nodecfg.tcl \ - nodes.tcl services.tcl ns2imunes.tcl plugins.tcl \ - tooltips.tcl topogen.tcl traffic.tcl util.tcl \ - version.tcl widget.tcl wlan.tcl wlanscript.tcl \ - exceptions.tcl +TCL_FILES := $(wildcard *.tcl) +ADDONS_FILES := $(wildcard addons/*) +CONFIG_FILES := $(wildcard configs/*) -ADDONS_FILES = addons/ipsecservice.tcl - -CONFIG_FILES = configs/sample1.imn configs/sample1.scen \ - configs/sample1-bg.gif configs/sample2-ssh.imn \ - configs/sample3-bgp.imn configs/sample4-nrlsmf.imn \ - configs/sample4.scen configs/sample4-bg.jpg \ - configs/sample5-mgen.imn configs/sample6-emane-rfpipe.imn \ - configs/sample7-emane-ieee80211abg.imn \ - configs/sample8-ipsec-service.imn \ - configs/sample9-vpn.imn \ - configs/sample10-kitchen-sink.imn - -# # CORE GUI script (/usr/local/bin/core-gui) -# dist_bin_SCRIPTS = core-gui -# # Tcl/Tk scripts (/usr/local/lib/core) -# -coredir = $(CORE_LIB_DIR) -dist_core_DATA = $(TCL_FILES) -dist_core_SCRIPTS = $(OTHER_FILES) +coredir = $(CORE_LIB_DIR) +dist_core_DATA = $(TCL_FILES) +dist_core_SCRIPTS = $(OTHER_FILES) -# # Addon files -# -coreaddonsdir = $(coredir)/addons +coreaddonsdir = $(coredir)/addons dist_coreaddons_DATA = $(ADDONS_FILES) -# # Sample configs (/usr/local/share/core/examples/configs) -# -coreconfigsdir = $(datadir)/core/examples/configs -dist_coreconfigs_DATA = $(CONFIG_FILES) - -dist-hook: - rm -rf $(distdir)/addons/.svn - -uninstall-hook: - rmdir -p $(coreconfigsdir) || true - rmdir -p $(coreaddonsdir) || true - rmdir -p $(coredir) || true +coreconfigsdir = $(datadir)/core/examples/configs +dist_coreconfigs_DATA = $(CONFIG_FILES) # extra cruft to remove -DISTCLEANFILES = Makefile.in +DISTCLEANFILES = Makefile.in # files to include in source tarball not included elsewhere -EXTRA_DIST = addons +EXTRA_DIST = addons diff --git a/gui/core-gui.in b/gui/core-gui.in index a66d7f77..a93fd72b 100755 --- a/gui/core-gui.in +++ b/gui/core-gui.in @@ -54,7 +54,7 @@ case $1 in exit 0 ;; -v | --version) - exec echo "`basename $0` version @CORE_VERSION@ (@CORE_VERSION_DATE@)" + exec echo "`basename $0` version @PACKAGE_VERSION@ (@PACKAGE_DATE@)" exit 0 ;; esac @@ -63,7 +63,7 @@ SHELL=/bin/sh export SHELL export LIBDIR="@CORE_LIB_DIR@" -export SBINDIR="@SBINDIR@" +export SBINDIR="@sbindir@" # eval is used here to expand "~" to user's home dir if [ x$CONFDIR = x ]; then export CONFDIR=`eval "echo @CORE_GUI_CONF_DIR@"` ; fi export CORE_STATE_DIR="@CORE_STATE_DIR@" diff --git a/gui/icons/Makefile.am b/gui/icons/Makefile.am index dc2b2e93..6575fad0 100644 --- a/gui/icons/Makefile.am +++ b/gui/icons/Makefile.am @@ -5,94 +5,25 @@ # author: Jeff Ahrenholz # -TINY_ICONS = tiny/button.play.gif \ - tiny/select.gif tiny/marker.gif \ - tiny/rj45.gif tiny/text.gif \ - tiny/edit-delete.gif tiny/stop.gif \ - tiny/blank.gif tiny/mobility.gif \ - tiny/script_play.gif tiny/arrow.gif \ - tiny/lanswitch.gif tiny/script_pause.gif \ - tiny/pc.gif tiny/rectangle.gif \ - tiny/observe.gif tiny/document-new.gif \ - tiny/document-save.gif \ - tiny/view-refresh.gif tiny/moboff.gif \ - tiny/document-properties.gif tiny/arrow.up.gif \ - tiny/host.gif tiny/hub.gif \ - tiny/twonode.gif tiny/router.gif \ - tiny/eraser.gif \ - tiny/stock_connect.gif tiny/stock_disconnect.gif \ - tiny/ping.gif tiny/link.gif \ - tiny/start.gif \ - tiny/trace.gif tiny/button.stop.gif \ - tiny/arrow.down.gif tiny/oval.gif \ - tiny/wlan.gif tiny/delete.gif \ - tiny/run.gif tiny/tunnel.gif \ - tiny/script_stop.gif \ - tiny/router_black.gif tiny/router_green.gif \ - tiny/router_red.gif tiny/router_yellow.gif \ - tiny/router_purple.gif \ - tiny/ap.gif tiny/mdr.gif \ - tiny/folder.gif \ - tiny/cel.gif \ - tiny/fileopen.gif \ - tiny/plot.gif +TINY_ICONS := $(wildcard tiny/*) +NORM_ICONS := $(wildcard normal/*) +SVG_ICONS := $(wildcard svg/*) -NORM_ICONS = normal/gps-diagram.xbm \ - normal/router_black.gif normal/host.gif \ - normal/hub.gif \ - normal/router.gif \ - normal/rj45.gif normal/antenna.gif \ - normal/text.gif \ - normal/lanswitch.gif normal/core-icon.png \ - normal/core-icon.xbm normal/oval.gif \ - normal/wlan.gif normal/pc.gif \ - normal/tunnel.gif normal/core-logo-275x75.gif \ - normal/router_red.gif normal/router_green.gif \ - normal/simple.xbm \ - normal/document-properties.gif \ - normal/thumb-unknown.gif \ - normal/router_purple.gif normal/router_yellow.gif \ - normal/ap.gif normal/mdr.gif - -SVG_ICONS = svg/ap.svg \ - svg/cel.svg \ - svg/hub.svg \ - svg/lanswitch.svg \ - svg/mdr.svg \ - svg/otr.svg \ - svg/rj45.svg \ - svg/router_black.svg \ - svg/router_green.svg \ - svg/router_purple.svg \ - svg/router_red.svg \ - svg/router.svg \ - svg/router_yellow.svg \ - svg/start.svg \ - svg/tunnel.svg \ - svg/vlan.svg - -# # Icon files (/usr/local/share/core/icons/[tiny,normal,svg]) -# -coreiconnormaldir = $(CORE_DATA_DIR)/icons/normal +coreiconnormaldir = $(CORE_DATA_DIR)/icons/normal dist_coreiconnormal_DATA = $(NORM_ICONS) -coreicontinydir = $(CORE_DATA_DIR)/icons/tiny -dist_coreicontiny_DATA = $(TINY_ICONS) -coreiconsvgdir = $(CORE_DATA_DIR)/icons/svg -dist_coreiconsvg_DATA = $(SVG_ICONS) -iconpixmapdir = $(datarootdir)/pixmaps -dist_iconpixmap_DATA = core-gui.xpm +coreicontinydir = $(CORE_DATA_DIR)/icons/tiny +dist_coreicontiny_DATA = $(TINY_ICONS) -icondesktopdir = $(datarootdir)/applications -dist_icondesktop_DATA = core-gui.desktop +coreiconsvgdir = $(CORE_DATA_DIR)/icons/svg +dist_coreiconsvg_DATA = $(SVG_ICONS) -uninstall-hook: - rmdir -p $(icondesktopdir) || true - rmdir -p $(iconpixmapdir) || true - rmdir -p $(coreiconsvgdir) || true - rmdir -p $(coreicontinydir) || true - rmdir -p $(coreiconnormaldir) || true +iconpixmapdir = $(datarootdir)/pixmaps +dist_iconpixmap_DATA = core-gui.xpm + +icondesktopdir = $(datarootdir)/applications +dist_icondesktop_DATA = core-gui.desktop # extra cruft to remove DISTCLEANFILES = Makefile.in diff --git a/gui/icons/normal/OVS.gif b/gui/icons/normal/OVS.gif old mode 100755 new mode 100644 diff --git a/gui/icons/svg/OVS.svg b/gui/icons/svg/OVS.svg old mode 100755 new mode 100644 diff --git a/gui/icons/tiny/OVS.gif b/gui/icons/tiny/OVS.gif old mode 100755 new mode 100644 diff --git a/gui/version.tcl.in b/gui/version.tcl.in index bc4e42e1..242a0e82 100644 --- a/gui/version.tcl.in +++ b/gui/version.tcl.in @@ -6,5 +6,5 @@ # # define the version number and release date here # -set CORE_VERSION @CORE_VERSION@ -set CORE_VERSION_DATE @CORE_VERSION_DATE@ +set CORE_VERSION @PACKAGE_VERSION@ +set CORE_VERSION_DATE @PACKAGE_DATE@ diff --git a/netns/MANIFEST.in b/netns/MANIFEST.in index c26545b7..e8fb6539 100644 --- a/netns/MANIFEST.in +++ b/netns/MANIFEST.in @@ -1,2 +1 @@ include *.h -include sbin/* diff --git a/netns/Makefile.am b/netns/Makefile.am index 131d593f..ee34df62 100644 --- a/netns/Makefile.am +++ b/netns/Makefile.am @@ -7,26 +7,25 @@ # Makefile for building netns. # -AM_CFLAGS = -Wall -fno-strict-aliasing -O3 -g @libev_CFLAGS@ -SETUPPY = setup.py -SETUPPYFLAGS = -v -# -DDEBUG +AM_CFLAGS = -Wall -fno-strict-aliasing -O3 -g @libev_CFLAGS@ +SETUPPY = setup.py +SETUPPYFLAGS = -v -SRC_COMMON = vnode_msg.c vnode_cmd.c vnode_chnl.c vnode_io.c \ - vnode_msg.h vnode_cmd.h vnode_chnl.h vnode_io.h \ - vnode_tlv.h myerr.h netns.h -SRC_VNODED = vnoded_main.c vnode_server.c netns.c \ - vnode_server.h -SRC_VCMD = vcmd_main.c vnode_client.c \ - vnode_client.h -SRC_NETNS = netns_main.c netns.c netns.h +SRC_COMMON = vnode_msg.c vnode_cmd.c vnode_chnl.c vnode_io.c \ + vnode_msg.h vnode_cmd.h vnode_chnl.h vnode_io.h \ + vnode_tlv.h myerr.h netns.h +SRC_VNODED = vnoded_main.c vnode_server.c netns.c \ + vnode_server.h +SRC_VCMD = vcmd_main.c vnode_client.c \ + vnode_client.h +SRC_NETNS = netns_main.c netns.c netns.h -sbin_PROGRAMS = vnoded vcmd netns -vnoded_LDADD = @libev_LIBS@ -vnoded_SOURCES = ${SRC_COMMON} ${SRC_VNODED} -vcmd_LDADD = @libev_LIBS@ -vcmd_SOURCES = ${SRC_COMMON} ${SRC_VCMD} -netns_SOURCES = ${SRC_NETNS} +noinst_PROGRAMS = vnoded vcmd netns +vnoded_LDADD = @libev_LIBS@ +vnoded_SOURCES = $(SRC_COMMON) $(SRC_VNODED) +vcmd_LDADD = @libev_LIBS@ +vcmd_SOURCES = $(SRC_COMMON) $(SRC_VCMD) +netns_SOURCES = $(SRC_NETNS) # this triggers automake to run setup.py for building the Python libraries # actual library names are netns.so and vcmd.so @@ -34,23 +33,23 @@ netns_SOURCES = ${SRC_NETNS} noinst_LIBRARIES = libnetns.a libnetns_a_SOURCES = netnsmodule.c vcmdmodule.c libnetns.a: - SBINDIR=@SBINDIR@ LDFLAGS="$(LDFLAGS) @libev_LIBS@" CFLAGS="$(CFLAGS) @libev_CFLAGS@" $(PYTHON) setup.py build_ext + LDFLAGS="$(LDFLAGS) @libev_LIBS@" CFLAGS="$(CFLAGS) @libev_CFLAGS@" $(PYTHON) setup.py build_ext # Python libraries install install-exec-local: - $(MKDIR_P) ${DESTDIR}/${pythondir} - $(MKDIR_P) ${DESTDIR}/${pyexecdir} - SBINDIR=${DESTDIR}/@SBINDIR@ PYTHONPATH=${DESTDIR}/${pythondir} $(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) install \ - --prefix=${DESTDIR}/${pyprefix} \ - --install-purelib=${DESTDIR}/${pythondir} \ - --install-platlib=${DESTDIR}/${pyexecdir} \ + $(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) install \ + --root=/$(DESTDIR) \ + --prefix=$(prefix) \ + --install-lib=$(pythondir) \ + --single-version-externally-managed \ --no-compile # Python libraries uninstall uninstall-hook: - rm -f ${pyexecdir}/core_python_netns-1.0-py${PYTHON_VERSION}.egg-info - rm -f ${pyexecdir}/netns.so - rm -f ${pyexecdir}/vcmd.so + rm -rf core_netns.egg-info + rm -rf $(DESTDIR)/$(pythondir)/core_netns-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg-info + rm -f $(DESTDIR)/$(bindir)/{vnoded,vcmd,netns} + rm -f $(DESTDIR)/$(pythondir)/{netns.so,vcmd.so} # Python libraries cleanup clean-local: clean-local-check @@ -58,16 +57,9 @@ clean-local: clean-local-check clean-local-check: -rm -rf build -rpmbuild.sh: - echo SBINDIR=@SBINDIR@ LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS) @libev_CFLAGS@" $(PYTHON) setup.py build > rpmbuild.sh - chmod a+x rpmbuild.sh - -rpm: rpmbuild.sh - $(PYTHON) setup.py bdist_rpm --build-script=rpmbuild.sh --requires="libev" --build-requires="libev-devel" - # extra cruft to remove -DISTCLEANFILES = Makefile.in rpmbuild.sh MANIFEST +DISTCLEANFILES = Makefile.in MANIFEST # include source files for Python libraries with distribution tarball -EXTRA_DIST = setup.py MANIFEST.in +EXTRA_DIST = setup.py MANIFEST.in diff --git a/netns/setup.py b/netns/setup.py index 8ef5083f..839faeae 100644 --- a/netns/setup.py +++ b/netns/setup.py @@ -3,25 +3,8 @@ Defines how CORE netns will be build for installation. """ from setuptools import setup, Extension -from distutils.command.install import install -class CustomInstall(install): - user_options = install.user_options + [ - ("service=", None, "determine which service file to include") - ] - - def initialize_options(self): - install.initialize_options(self) - self.service = "sysv" - - def finalize_options(self): - install.finalize_options(self) - assert self.service in ("sysv", "systemd"), "must be sysv or systemd" - - def run(self): - install.run(self) - netns = Extension( "netns", sources=[ @@ -58,7 +41,4 @@ setup( author_email="core-dev@nrl.navy.mil", license="BSD", long_description="Extension modules and utilities to support virtual nodes using Linux network namespaces", - cmdclass={ - "install": CustomInstall - } ) diff --git a/netns/version.h.in b/netns/version.h.in index 557b691d..a7489514 100644 --- a/netns/version.h.in +++ b/netns/version.h.in @@ -11,6 +11,6 @@ #ifndef _VERSION_H_ #define _VERSION_H_ -#define CORE_VERSION "@CORE_VERSION@" +#define CORE_VERSION "@PACKAGE_VERSION@" #endif /* _VERSION_H_ */ diff --git a/ns3/Makefile.am b/ns3/Makefile.am index 346daf5c..bf398426 100644 --- a/ns3/Makefile.am +++ b/ns3/Makefile.am @@ -7,17 +7,12 @@ # Makefile for building corens3 components. # -SETUPPY = setup.py -SETUPPYFLAGS = -v +SETUPPY = setup.py +SETUPPYFLAGS = -v -EXAMPLE_FILES = \ - examples/ns3lte.py \ - examples/ns3wifi.py \ - examples/ns3wifirandomwalk.py \ - examples/ns3wimax.py - -coreexampledir = $(datadir)/core/examples/corens3 -dist_coreexample_SCRIPTS= $(EXAMPLE_FILES) +#EXAMPLE_FILES := $(wildcard examples/*) +#coreexampledir = $(datadir)/core/examples/corens3 +#dist_coreexample_SCRIPTS = $(EXAMPLE_FILES) # Python package build noinst_SCRIPTS = build @@ -26,34 +21,30 @@ build: # Python package install install-exec-hook: - $(MKDIR_P) ${DESTDIR}/${pythondir} - $(MKDIR_P) ${DESTDIR}/${pyexecdir} - PYTHONPATH=${DESTDIR}/${pythondir} $(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) install \ - --prefix=${DESTDIR}/${pyprefix} \ - --install-purelib=${DESTDIR}/${pythondir} \ - --install-platlib=${DESTDIR}/${pyexecdir} \ + $(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) install \ + --root=/$(DESTDIR) \ + --prefix=$(prefix) \ + --install-lib=$(pythondir) \ + --single-version-externally-managed \ --no-compile # Python package uninstall uninstall-hook: - rm -f ${pythondir}/corens3_python-${COREDPY_VERSION}-py${PYTHON_VERSION}.egg-info - rm -rf ${pythondir}/corens3 - rmdir -p $(coreexampledir) || true + rm -rf core_ns3.egg-info + rm -rf $(DESTDIR)/$(pythondir)/core_ns3-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg-info + rm -rf $(DESTDIR)/$(pythondir)/corens3 + rm -rf $(DESTDIR)/$(datadir)/corens3 # Python package cleanup clean-local: -rm -rf build -# Python RPM package -rpm: - $(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) bdist_rpm - # because we include entire directories with EXTRA_DIST, we need to clean up # the source control files dist-hook: - rm -rf `find $(distdir)/ -name .svn` `find $(distdir)/ -name '*.pyc'` + rm -rf `find $(distdir)/ -name '*.pyc'` -DISTCLEANFILES = Makefile.in *.pyc corens3/*.pyc MANIFEST +DISTCLEANFILES = Makefile.in *.pyc corens3/*.pyc MANIFEST # files to include with distribution tarball -EXTRA_DIST = LICENSE $(SETUPPY) corens3 +EXTRA_DIST = LICENSE $(SETUPPY) corens3 diff --git a/ns3/corens3/.gitignore b/ns3/corens3/.gitignore deleted file mode 100644 index 18b5fbad..00000000 --- a/ns3/corens3/.gitignore +++ /dev/null @@ -1 +0,0 @@ -constants.py diff --git a/ns3/corens3/constants.py.in b/ns3/corens3/constants.py.in deleted file mode 100644 index 05784d6c..00000000 --- a/ns3/corens3/constants.py.in +++ /dev/null @@ -1,18 +0,0 @@ -# Constants created by autoconf ./configure script -COREDPY_VERSION = "@COREDPY_VERSION@" -CORE_STATE_DIR = "@CORE_STATE_DIR@" -CORE_CONF_DIR = "@CORE_CONF_DIR@" -CORE_DATA_DIR = "@CORE_DATA_DIR@" -CORE_LIB_DIR = "@CORE_LIB_DIR@" -CORE_SBIN_DIR = "@SBINDIR@" - -BRCTL_BIN = "@brctl_path@/brctl" -IP_BIN = "@ip_path@/ip" -TC_BIN = "@tc_path@/tc" -EBTABLES_BIN = "@ebtables_path@/ebtables" -IFCONFIG_BIN = "@ifconfig_path@/ifconfig" -NGCTL_BIN = "@ngctl_path@/ngctl" -VIMAGE_BIN = "@vimage_path@/vimage" -QUAGGA_STATE_DIR = "@CORE_STATE_DIR@/run/quagga" -MOUNT_BIN = "@mount_path@/mount" -UMOUNT_BIN = "@umount_path@/umount" diff --git a/ns3/setup.py b/ns3/setup.py index 9154d76e..c49d225e 100644 --- a/ns3/setup.py +++ b/ns3/setup.py @@ -1,11 +1,16 @@ +import glob + from setuptools import setup +_EXAMPLES_DIR = "share/corens3/examples" + setup( name="core-ns3", version="5.1", packages=[ "corens3", ], + data_files=[(_EXAMPLES_DIR, glob.glob("examples/*"))], description="Python ns-3 components of CORE", url="http://www.nrl.navy.mil/itd/ncs/products/core", author="Boeing Research & Technology", diff --git a/scripts/core-daemon.service.in b/scripts/core-daemon.service.in index b0c4a7f2..3d5c05fd 100644 --- a/scripts/core-daemon.service.in +++ b/scripts/core-daemon.service.in @@ -5,7 +5,7 @@ After=network.target [Service] Type=forking PIDFile=/var/run/core-daemon.pid -ExecStart=@PYTHON@ @SBINDIR@/core-daemon -d +ExecStart=@PYTHON@ @bindir@/core-daemon -d TasksMax=infinity [Install] diff --git a/scripts/perf/Makefile.am b/scripts/perf/Makefile.am index b9ea48d7..7531ba82 100644 --- a/scripts/perf/Makefile.am +++ b/scripts/perf/Makefile.am @@ -17,7 +17,7 @@ dist_hooks_SCRIPTS = perflogstart.sh perflogstop.sh sessiondatacollect.sh \ configuration_hook.sh datacollect_hook.sh # Files installed to /etc/core/ -perfconfdir=$(sysconfdir)/core +perfconfdir=$(CORE_CONF_DIR) dist_perfconf_DATA = perflogserver.conf uninstall-hook: