File debian.ethercat-dkms.dkms of Package ethercat

kmajorminor=`echo $kernelver | cut -d . --complement -f 3-`
CONFIGURE_ARGS="--enable-sii-assign --disable-rt-syslog --disable-tool --disable-userlib --enable-generic --enable-ccat --disable-tty"
CONFIGURE_ARGS+=" --with-linux-dir=$kernel_source_dir"

PACKAGE_NAME="ethercat-dkms"
PACKAGE_VERSION="#MODULE_VERSION#"
AUTOINSTALL="YES"
BUILT_MODULE_NAME[0]="ec_master"
BUILT_MODULE_LOCATION[0]="master/"
DEST_MODULE_LOCATION[0]="/kernel/extra/ethercat"
BUILT_MODULE_NAME[1]="ec_generic"
BUILT_MODULE_LOCATION[1]="devices/"
DEST_MODULE_LOCATION[1]="/kernel/extra/ethercat"
BUILT_MODULE_NAME[2]="ec_ccat"
BUILT_MODULE_LOCATION[2]="devices/ccat/"
DEST_MODULE_LOCATION[2]="/kernel/extra/ethercat"
POST_BUILD="save_module_symvers $dkms_tree"

for km in e1000 e1000e igb igbvf ixgbevf igc; do
    if [ -r $source_tree/ethercat-dkms-#MODULE_VERSION#/devices/$km/$km-${kmajorminor}-ethercat.h ] && grep -i -q "^CONFIG_${km}=m$" $kernel_source_dir/.config; then
        idx=${#BUILT_MODULE_NAME[@]}
        BUILT_MODULE_NAME[$idx]="ec_$km"
        BUILT_MODULE_LOCATION[$idx]="devices/$km/"
        DEST_MODULE_LOCATION[$idx]="/kernel/extra/ethercat"
        CONFIGURE_ARGS+=" --enable-$km"
    else
        CONFIGURE_ARGS+=" --disable-$km"
    fi
done

for km in 8139too e100; do
    if [ -r $source_tree/ethercat-dkms-#MODULE_VERSION#/devices/$km-$kmajorminor-ethercat.c ] && grep -i -q "^CONFIG_${km}=m$" $kernel_source_dir/.config; then
        idx=${#BUILT_MODULE_NAME[@]}
        BUILT_MODULE_NAME[$idx]="ec_$km"
        BUILT_MODULE_LOCATION[$idx]="devices/"
        DEST_MODULE_LOCATION[$idx]="/kernel/extra/ethercat"
        CONFIGURE_ARGS+=" --enable-$km"
    else
        CONFIGURE_ARGS+=" --disable-$km"
    fi
done

if [ -r $source_tree/ethercat-dkms-#MODULE_VERSION#/devices/r8169-$kmajorminor-ethercat.c && grep -q "^CONFIG_R8169=m$" $kernel_source_dir/.config ]; then
    idx=${#BUILT_MODULE_NAME[@]}
    BUILT_MODULE_NAME[$idx]="ec_r8169"
    BUILT_MODULE_LOCATION[$idx]="devices/"
    DEST_MODULE_LOCATION[$idx]="/kernel/extra/ethercat"
    CONFIGURE_ARGS+=" --enable-r8169"
elif [ -r $source_tree/ethercat-dkms-#MODULE_VERSION#/devices/r8169/r8169-${kmajorminor}-ethercat.h && grep -q "^CONFIG_R8169=m$" $kernel_source_dir/.config ]; then
    idx=${#BUILT_MODULE_NAME[@]}
    BUILT_MODULE_NAME[$idx]="ec_r8169"
    BUILT_MODULE_LOCATION[$idx]="devices/r8169/"
    DEST_MODULE_LOCATION[$idx]="/kernel/extra/ethercat"
    CONFIGURE_ARGS+=" --enable-r8169"
else
    CONFIGURE_ARGS+=" --disable-r8169"
fi

if [ -r $source_tree/ethercat-dkms-#MODULE_VERSION#/devices/genet/bcmgenet-$kmajorminor-ethercat.h ] && grep -q "^CONFIG_BCMGENET=m$" $kernel_source_dir/.config; then
    idx=${#BUILT_MODULE_NAME[@]}
    BUILT_MODULE_NAME[$idx]="ec_genet"
    BUILT_MODULE_LOCATION[$idx]="devices/genet/"
    DEST_MODULE_LOCATION[$idx]="/kernel/extra/ethercat"
    CONFIGURE_ARGS+=" --enable-genet"
else
    CONFIGURE_ARGS+=" --disable-genet"
fi

MAKE[0]="./configure ${CONFIGURE_ARGS} && make modules"
openSUSE Build Service is sponsored by