[Galaxy S 4 Mini General] k2wl:
use this instructions to initialize build environment for cm13

http://developer.sonymobile.com/kno...aosp-marshmallow-for-unlocked-xperia-devices/

1. jdk 8 is not supported for building so please dont use it.

2.use following xml in .repo/local_manifests

<project name="CyanogenMod/android_device_samsung_msm8930-common" path="device/samsung/msm8930-common" remote="github" revision="cm-13.0" />
<project name="CyanogenMod/android_device_samsung_serrano-common" path="device/samsung/serrano-common" remote="github" revision="cm-13.0" />
<project name="CyanogenMod/android_kernel_samsung_msm8930-common" path="kernel/samsung/msm8930-common" remote="github" revision="cm-13.0" />
<project name="k2wl/android_device_samsung_serranodsdd" path="device/samsung/serranodsdd" remote="github" revision="cm-13.0" />
<project name="CyanogenMod/android_device_samsung_qcom-common" path="device/samsung/qcom-common" remote="github" revision="cm-13.0" />
<project name="CyanogenMod/android_hardware_samsung" path="hardware/samsung" remote="github" revision="cm-13.0" />
<project name="sileshn/proprietary_vendor_samsung" path="vendor/samsung" remote="github" revision="cm-13.0" />
<project name="CyanogenMod/android_device_qcom_common" path="device/qcom/common" remote="github" revision="cm-13.0"/>
<project name="CyanogenMod/android_external_stlport" path="external/stlport" revision="cm-13.0" remote="github" />
<remove-project name="CyanogenMod/android_device_generic_arm64" groups="pdk" remote="cm" />
<remove-project name="CyanogenMod/android_device_generic_armv7-a-neon" groups="pdk" remote="cm" />
<remove-project name="CyanogenMod/android_device_generic_common" groups="pdk" remote="cm" />
<remove-project name="CyanogenMod/android_device_generic_goldfish" groups="pdk" remote="cm" />

<remove-project name="CyanogenMod/android_device_generic_mips" groups="pdk" remote="cm" />
<remove-project name="CyanogenMod/android_device_google_atv" groups="device,fugu,broadcom_pdk,generic_fs" remote="cm" />

<remove-project name="CyanogenMod/android_hardware_intel_common_libmix" groups="intel" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_intel_common_libva" groups="intel" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_intel_common_libwsbm" groups="intel" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_intel_common_omx-components" groups="intel" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_intel_img_hwcomposer" groups="intel" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_intel_img_psb_headers" groups="intel" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_intel_img_psb_video" groups="intel" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_invensense" groups="invensense" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_nvidia_audio" groups="nvidia_audio" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_samsung_slsi_exynos5" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_ti_omap4" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_ti_omap4xxx" groups="omap4" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_ti_wlan" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_ti_wpan" remote="cm" />
<remove-project name="device/generic/mini-emulator-arm64" groups="pdk" remote="aosp" />
<remove-project name="device/generic/mini-emulator-armv7-a-neon" groups="pdk" remote="aosp" />

<remove-project name="device/generic/mini-emulator-mips" groups="pdk" remote="aosp" />
<remove-project name="device/generic/mini-emulator-x86" groups="pdk" remote="aosp" />
<remove-project name="device/generic/mini-emulator-x86_64" groups="pdk" remote="aosp" />
<remove-project name="device/generic/qemu" remote="aosp" />
<remove-project name="device/generic/x86" groups="pdk" remote="aosp" />
<remove-project name="device/generic/x86_64" groups="pdk" remote="aosp" />
<remove-project name="device/google/accessory/arduino" groups="device" remote="aosp" />
<remove-project name="device/google/accessory/demokit" groups="device" remote="aosp" />
<remove-project name="device/sample" groups="pdk" remote="aosp" />
<remove-project name="platform/hardware/intel/audio_media" groups="intel" remote="aosp" />
<remove-project name="platform/hardware/intel/bootstub" groups="intel" remote="aosp" />
<remove-project name="platform/hardware/intel/common/bd_prov" groups="intel" remote="aosp" />
<remove-project name="platform/hardware/intel/common/libstagefrighthw" groups="intel" remote="aosp"/>
<remove-project name="platform/hardware/intel/common/utils" groups="intel" remote="aosp" />
<remove-project name="platform/hardware/intel/common/wrs_omxil_core" groups="intel" remote="aosp" />
<remove-project name="platform/hardware/intel/sensors" groups="intel_sensors" remote="aosp" />
<remove-project name="platform/hardware/marvell/bt" groups="marvell_bt" remote="aosp" />
<remove-project name="platform/hardware/mediatek" groups="mediatek,mediatek_wear" remote="aosp" />

<remove-project name="platform/hardware/ti/omap3" groups="omap3" remote="aosp" />
<remove-project name="platform/hardware/ti/omap4-aah" groups="omap4-aah" remote="aosp" />

<remove-project name="platform/prebuilts/android-emulator" groups="pdk-fs" clone-depth="1" />
<remove-project name="platform/prebuilts/clang/darwin-x86/host/3.6" groups="pdk,darwin" />

<remove-project name="platform/prebuilts/gcc/darwin-x86/aarch64/aarch64-linux-android-4.9" groups="pdk,darwin,arm" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.8" groups="pdk,darwin,arm" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.9" groups="pdk,darwin,arm" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/host/headers" groups="pdk,darwin" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1" groups="pdk,darwin" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/mips/mips64el-linux-android-4.9" groups="pdk,darwin,mips" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/x86/x86_64-linux-android-4.9" groups="pdk,darwin,x86" />

<remove-project name="platform/prebuilts/gcc/linux-x86/mips/mips64el-linux-android-4.9" groups="pdk,linux,mips" />

<remove-project name="platform/prebuilts/python/darwin-x86/2.7.5" groups="darwin,pdk,pdk-cw-fs" />

removing those unnecessary repos will speed up your syncing

3. make build.sh in your cm13 folder with following content

#!/bin/bash
cd ~/cm13
repo sync -f --force-sync
rm -rf out/target/product/serranodsdd
. device/samsung/serranodsdd/patches/install-all.sh
##############
cd ~/cm13
. build/envsetup.sh
brunch serranodsdd

this sync up and build your code automatically with patching the source with necessary patches everytime you run this script

./build.sh

4. your output folder is out/target/product/serranodsdd/

your output zip is in that folder named

cm-13.0-*-UNOFFICIAL-serranodsdd.zip