Skip to content
Snippets Groups Projects
dunecontrol 39.7 KiB
Newer Older
  • Learn to ignore specific revisions
  •       export DUNE_BUILDDIR=""
        ;;
        --skipversioncheck)
    
          export SKIPVERSIONCHECK=yes
    
    Christian Engwer's avatar
    Christian Engwer committed
        --current)
    
    Christian Engwer's avatar
    Christian Engwer committed
            cd ..
    
            if test "$OLDPWD" = "$PWD"; then
              echo "You are not inside the source tree of a DUNE module." >&2
              exit -1
            fi
          done;
          parse_control $PWD/$CONTROL
    
    Christian Engwer's avatar
    Christian Engwer committed
          fix_and_assign MODULE "$module"
          export SEARCH_MODULES="$SEARCH_MODULES $MODULE"
          export ONLY="$ONLY $MODULE"
    
    Christian Engwer's avatar
    Christian Engwer committed
        ;;
    
        --current-dep)
          while ! test -f $CONTROL; do
            cd ..
            if test "$OLDPWD" = "$PWD"; then
              echo "You are not inside the source tree of a DUNE module." >&2
              exit -1
            fi
          done;
          parse_control $PWD/$CONTROL
          fix_and_assign MODULE "$module"
          export SEARCH_MODULES="$SEARCH_MODULES $MODULE"
        ;;
    
          export RESUME_FLAG="yes"
    
    Christian Engwer's avatar
    Christian Engwer committed
        --debug) true ;; # ignore this option, it is handled right at the beginning
    
          echo "ERROR: Unknown option \`$option'"  >&2
          echo  >&2
    
    extract_multiarch
    
    # create PKG_CONFIG_PATH for installed dune modules
    for i in $MULTIARCH_LIBDIR lib64 lib32 lib; do
      if test -d "$PREFIX_DIR/$i/pkgconfig"; then
        export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PREFIX_DIR/$i/pkgconfig"
      fi
    done
    
    
    # we assume there should be a command...
    
    Christian Engwer's avatar
    Christian Engwer committed
    if test "x$command" = "x"; then
    
    Christian Engwer's avatar
    Christian Engwer committed
    case "$command" in
    
      print)
        create_module_list
        eval "print_module_list ' ' $MODULES"
        echo >&2
        ;;
    
      info)
        create_module_list
        echo $SORTEDMODULES_INFO
      ;;
    
      export)
        create_module_list
        DUNE_CONTROL_PATH=""
        for mod in $MODULES; do
    
    Christian Engwer's avatar
    Christian Engwer committed
          name=$(eval echo \$NAME_$mod)
    
    Christian Engwer's avatar
    Christian Engwer committed
          if test -f "$path/dune.module"; then
            export DUNE_CONTROL_PATH="$DUNE_CONTROL_PATH:$path/dune.module"
    
    Christian Engwer's avatar
    Christian Engwer committed
            if test -f "$path/lib/dunecontrol/$name/dune.module"; then
              export DUNE_CONTROL_PATH="$DUNE_CONTROL_PATH:$path/lib/dunecontrol/$name/dune.module"
            else
              echo "ERROR: while creating list of dune.module files"  >&2
              echo "       couldn't find dune.module file for $name in $path" >&2
              echo  >&2
              exit 1
            fi
    
        echo export DUNE_CONTROL_PATH=$(echo $DUNE_CONTROL_PATH | $SED -e 's/^://')
    
    Christian Engwer's avatar
    Christian Engwer committed
        if test "x$SEARCH_MODULES" == "x"; then
          echo "ERROR: printdeps requires an explicit --module=... parameter"  >&2
          exit 1
        fi
    
        mainmod=`echo $SEARCH_MODULES`
        name=`eval echo \\${NAME_$mainmod}`
        echo "dependencies for $name"
        ### DEPENDENCIES
    
    Christian Engwer's avatar
    Christian Engwer committed
        sort_modules $mainmod
        for mod in $SORTEDMODULES_DEPS; do
    
    Christian Engwer's avatar
    Christian Engwer committed
        for mod in $SORTEDMODULES_SUGS; do
    
    Christian Engwer's avatar
    Christian Engwer committed
        if test "x$SEARCH_MODULES" == "x"; then
          echo "ERROR: m4create requires an explicit --module=... parameter"  >&2
          exit 1
        fi
    
        eval mainmodpath="\$PATH_$mainmod"
    
        fname="$mainmodpath/dependencies.m4"
    
        name=`eval echo \\${NAME_$mainmod}`
        version=`eval echo \\${VERS_$mainmod}`
        maintainer=`eval echo \\${MAIN_$mainmod}`
        # get dependencies
    
        deps=`echo "$deps" | $SED 's/^ *//'`
    
        while test -n "$deps"; do
          #the end of the name is marked either by space, opening paren
          #or comma
          depname="${deps%%[ (,]*}"
          #remove the name and adjacent whitespace
    
          deps=`echo "$deps" | $SED 's/^[^ (,]* *//'`
    
          #check whether there is a dependency version
          case "$deps" in
          '('*) deps="${deps#(}"
                depver="${deps%%)*}"
                deps="${deps#*)}"
                ;;
          *)    depver=
                ;;
          esac
          #remove any leading whitespace or commas for te next iteration
    
          deps=`echo "$deps" | $SED 's/^[, ]*//'`
    
        # get suggestions
        eval sugs=\$SUGS_$mainmod
        #initially remove leading space
    
        sugs=`echo "$sugs" | $SED 's/^ *//'`
    
        while test -n "$sugs"; do
          #the end of the name is marked either by space, opening paren
          #or comma
          sugsname="${sugs%%[ (,]*}"
          #remove the name and adjacent whitespace
    
          sugs=`echo "$sugs" | $SED 's/^[^ (,]* *//'`
    
          #check whether there is a dependency version
          case "$sugs" in
          '('*) sugs="${sugs#(}"
                sugsver="${sugs%%)*}"
                sugs="${sugs#*)}"
                ;;
          *)    sugver=
                ;;
          esac
          #remove any leading whitespace or commas for te next iteration
    
          sugs=`echo "$sugs" | $SED 's/^[, ]*//'`
    
    
          suggests="$suggests $sugsname"
          suggestsall="$suggestsall $sugsname $sugsver "
        done
    
        # ensure a version number
        if test "x$version" = "x"; then version="0.0"; fi
        echo "writing $fname"
        echo "    for $name $version $maintainer"
        echo "        requires $requires"
    
          AC_MACRO_DIR="."
          test ! -d m4 || AC_MACRO_DIR=m4
    
    # dependencies.m4 generated by dunecontrol
    
    
    m4_define([DUNE_AC_INIT],[
      AC_INIT([$name], [$version], [$maintainer])
    
      AM_INIT_AUTOMAKE([foreign 1.9 tar-pax])
    
      m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([no])])
    
      AC_SUBST([DUNE_MOD_VERSION], [$version])
      AC_SUBST([DUNE_MOD_NAME], [$name])
    
      AC_SUBST([DUNE_MAINTAINER_NAME], ["$maintainer"])
    
      DUNE_PARSE_MODULE_VERSION([$name], [$version])
    
    Christian Engwer's avatar
    Christian Engwer committed
      REQUIRES="$requires"
      AC_SUBST(REQUIRES, [$REQUIRES])
    
      AC_CONFIG_MACRO_DIR([$AC_MACRO_DIR])
    
        ### initialize AM_CONDITIONAL for suggestions that were not found
    
          mod=$(fix_variable_name $name)
          MOD=`echo $mod | tr [:lower:] [:upper:]`
          if test "x$(eval echo \$HAVE_$mod)" = "x"; then
    
      ### add a conditional check for $name,
      # just in case the module is not available at autogen time
      AM_CONDITIONAL([HAVE_${MOD}], false)
    EOF
    
    Christian Engwer's avatar
    Christian Engwer committed
          fi
    
    Christian Engwer's avatar
    Christian Engwer committed
    	### ANALYSE MODULE
        sort_modules $mainmod
    
    Christian Engwer's avatar
    Christian Engwer committed
        for mod in $SORTEDMODULES_DEPS; do
    
          name=`eval echo \\$NAME_$mod`
          MOD=`echo $mod | tr [:lower:] [:upper:]`
    
      ### check dependency $name
      # invoke checks required by this module
      AC_REQUIRE([${MOD}_CHECKS])
      # invoke check for this module
      AC_REQUIRE([${MOD}_CHECK_MODULE])
      if test x\$with_$mod = xno; then
        AC_MSG_ERROR([could not find required module _dune_name])
      fi
    EOF
    
    Christian Engwer's avatar
    Christian Engwer committed
        for mod in $SORTEDMODULES_SUGS; do
    
          name=`eval echo \\$NAME_$mod`
          MOD=`echo $mod | tr [:lower:] [:upper:]`
    
      ### check suggestion $name
      # invoke checks required by this module
      AC_REQUIRE([${MOD}_CHECKS])
      # invoke check for this module
      AC_REQUIRE([${MOD}_CHECK_MODULE])
      if test x\$with_$mod = xno; then
        AC_MSG_WARN([could not find suggested module _dune_name])
      fi
    EOF
    
        done
        ###
        # only test for the module if we really define our own checks
        if test -d m4; then
          mod=$mainmod
          name=`eval echo \\$NAME_$mod`
          MOD=`echo $mod | tr [:lower:] [:upper:]`
    
      ### invoke checks for $name
      AC_REQUIRE([${MOD}_CHECKS])
    
        set +e
        if test "x$USE_CMAKE" = "xno"; then
    
          echo "$PREFIX_DIR" |$GREP "[ 	]" >/dev/null
    
         if test "$?" -eq "0"; then
            echo "ERROR: The prefix directory path ($PREFIX_DIR) contains spaces. This is not"
            echo "       supported when using autotools."
            echo "       Either rename the path or activate CMake with --use-cmake switch."
            exit 1
          fi
        fi
        set -e
    
        if test "$1" = "update"; then export SKIPVERSIONCHECK=yes; fi
    
        check_commands "$@"
        create_module_list
        NAMES=""
        BUILDMODULES=""
        for mod in $MODULES; do
          if test "$(eval echo \$INST_$mod)" != "yes"; then
            NAMES="$NAMES$(eval echo \$NAME_$mod) "
            BUILDMODULES="$BUILDMODULES$mod "
    
        done
        echo "--- going to build $NAMES ---"
    
        if test -n "$RESUME_FILE"; then
            # write all modules to the resume file
            for mod in $MODULES ; do
                echo "$mod"
            done > "$RESUME_FILE"
        fi
    
    
    Christian Engwer's avatar
    Christian Engwer committed
          build_module "$mod" "$@"
    
    
          if test -n "$RESUME_FILE"; then
              # remove the current module from the resume file
    
              modules_togo=`cat "$RESUME_FILE"`
    
              for mod_togo in $modules_togo ; do
                  if test "$mod_togo" != "$mod" ; then
                      echo "$mod_togo"
                  fi
              done > "$RESUME_FILE"
          fi
    
    Christian Engwer's avatar
    Christian Engwer committed
        done