static function getOpts( $extname='', $version='', $cliopts = array() )
    {
        self::setConfigDir( $cliopts );

        if ( $version == '' && self::isValidVersion( $extname ) )
        {
            // lazy user
            $version = $extname;
            $extname = '';
        }

        if ( $version != '' && !self::isValidVersion( $version ) )
        {
            throw new PakeException( "'$version' is not a valid version number" );
        }

        if ( $extname == '' )
        {
            $extname = self::getDefaultExtName();
        }

        /// @bug we cache the options gotten from disk, but what if this function is invoked multiple times with different cli options?
        if ( !isset( self::$options[$extname] ) || !is_array( self::$options[$extname] ) )
        {
            // custom config file
            if ( isset( $cliopts['config-file'] ) )
            {
                $cfgfile = $cliopts['config-file'];
            }
            else
            {
                $cfgfile = self::getOptionsDir() . "/options-$extname.yaml";
            }

            // user-local config file
            if ( isset( $cliopts['user-config-file'] ) )
            {
                $usercfgfile = $cliopts['user-config-file'];
                if ( !is_file( $cliopts['user-config-file'] ) )
                {
                    throw new PakeException( "Could not find user-configuration-file {$cliopts['user-config-file']}" );
                }
            }
            else
            {
                $usercfgfile = self::getOptionsDir() . "/options-user.yaml";
            }

            // command-line config options
            foreach( $cliopts as $opt => $val )
            {
                if ( substr( $opt, 0, 7 ) == 'option.')
                {
                    unset( $cliopts[$opt] );

                    // transform dotted notation in array structure
                    $work = array_reverse( explode( '.', substr( $opt, 7 ) ) );
                    $built = array( array_shift( $work ) => $val );
                    foreach( $work as $key )
                    {
                        $built = array( $key=> $built );
                    }
                    self::recursivemerge( $cliopts, $built );
                }
            }

            self::loadConfiguration( $cfgfile, $extname, $version, $usercfgfile, $cliopts );
        }

        pake_echo( "Building extension $extname ( " . self::$options[$extname]['extension']['name'] . " ) version " .
            self::$options[$extname]['version']['alias'] .
            self::$options[$extname]['releasenr']['separator'] .
            self::$options[$extname]['version']['release'] );

        return self::$options[$extname];
    }