<commit_before>#!/bin/sh

p_source_dir="$pkg_src_dir/sigma-mrua"

case $pkg_sdk_version in
    309) p_source_branch="3.9.2"  ;;
    311) p_source_branch="3.11.3" ;;
    400) p_source_branch="4.0.0"  ;;
esac

p_jobs=1

use_env tools
use_toolchain target

export ARCH=mips
export KCFLAGS="-mhard-float -Wa,-mhard-float"

pkg_build() {
    p_run make
    p_run make
    p_run make -C MRUA_src/splashscreen/utils
}

pkg_modules() {
    local src_dir="$p_source_dir/modules/$kernel_release"

    p_run cd "$src_dir"
    p_install_modules em8xxx llad

    if in_flags with_alsa; then
        p_run cp -f \
            "$p_source_dir/MRUA_src/rua/emhwlib_kernel/kernel_src/em8xxxalsa.ko" \
            "$src_dir"
        p_install_modules em8xxxalsa
    fi
}

pkg_install() {
    local libs

    for bin in ikc xkc; do
        p_run install -vm 755 \
            "$p_source_dir/bin/$bin" \
            "$sdk_firmware_dir/bin"
    done

    for bin in gbus_read_bin_to_file gbus_read_uint32; do
        p_run install -vm 755 \
            "$p_source_dir/MRUA_src/llad_smallapps/$bin" \
            "$sdk_firmware_dir/bin"
    done

    for bin in rmfree rmmalloc; do
        p_run install -vm 755 \
            "$p_source_dir/MRUA_src/llad_xtest/$bin" \
            "$sdk_firmware_dir/bin"
    done

    libs="gbus llad rmchannel rmcore rmcw rmmm rmmm_g rmmm_t"

    libs="$libs \
        rmcec \
        rmedid \
        rmhdmi \
        rmhsi \
        rmi2c \
        rmsha1 \
        rmvideoout \
        rua"

    libs="$libs \
        rmoutput \
        ruaoutput"

    for lib in $libs; do
        p_run install -vm 755 \
            "$p_source_dir/lib/lib${lib}.so" \
            "$sdk_firmware_dir/lib"
    done
<commit_msg>Rebuild some mrua libs to properly propagade debug flags<commit_after>#!/bin/sh

p_source_dir="$pkg_src_dir/sigma-mrua"

case $pkg_sdk_version in
    309) p_source_branch="3.9.2"  ;;
    311) p_source_branch="3.11.3" ;;
    400) p_source_branch="4.0.0"  ;;
esac

p_jobs=1

use_env tools
use_toolchain target

export ARCH=mips
export KCFLAGS="-mhard-float -Wa,-mhard-float"

build_libs="rmcore rmcec rmedid rmhdmi rmhsi rmi2c rmsha1 rmvideoout rmoutput"

pkg_build() {
    p_run make

    for lib in $build_libs; do
        p_run make -C "MRUA_src/$lib/src"
    done

    p_run make -C MRUA_src/gbuslib/src
    p_run make -C MRUA_src/rmoutput/rua/src
    p_run make -C MRUA_src/splashscreen/utils
}

pkg_modules() {
    local src_dir="$p_source_dir/modules/$kernel_release"

    p_run cd "$src_dir"
    p_install_modules em8xxx llad

    if in_flags with_alsa; then
        p_run cp -f \
            "$p_source_dir/MRUA_src/rua/emhwlib_kernel/kernel_src/em8xxxalsa.ko" \
            "$src_dir"
        p_install_modules em8xxxalsa
    fi
}

pkg_install() {
    local bin_dst="$sdk_firmware_dir/bin"
    local lib_dst="$sdk_firmware_dir/lib"

    for bin in ikc xkc; do
        p_run cp -va "$p_source_dir/bin/$bin" "$bin_dst"
    done

    for bin in gbus_read_bin_to_file gbus_read_uint32; do
        p_run cp -va "$p_source_dir/MRUA_src/llad_smallapps/$bin" "$bin_dst"
    done

    for bin in rmfree rmmalloc; do
        p_run cp -va "$p_source_dir/MRUA_src/llad_xtest/$bin" "$bin_dst"
    done

    for lib in $build_libs; do
        p_run cp -va "$p_source_dir/MRUA_src/$lib/src/lib${lib}.so" "$lib_dst"
    done

    p_run cp -va "$p_source_dir/MRUA_src/gbuslib/src/libgbus.so" "$lib_dst"
    p_run cp -va "$p_source_dir/MRUA_src/rmoutput/rua/src/libruaoutput.so" "$lib_dst"

    local libs="llad rmchannel rmcw rmmm rmmm_g rmmm_t rua"

    for lib in $libs; do
        p_run cp -va "$p_source_dir/lib/lib${lib}.so" "$lib_dst"
    done
{'fraction_non_alphanumeric': 0.10504774897680765, 'fraction_numerical': 0.01800818553888131, 'mean_word_length': 2.471590909090909, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1318563', 'n_tokens_mistral': 1540, 'n_tokens_neox': 1473, 'n_words': 292}