2020-03-31 16:21:07 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
source_dir=$1
|
|
|
|
|
build_dir=$2
|
|
|
|
|
platform=$3
|
|
|
|
|
machine=$4
|
|
|
|
|
|
|
|
|
|
echo "Building $machine-$platform sysroot"
|
|
|
|
|
mkdir -p $build_dir/sysroot/usr/include/{sys,machine}
|
|
|
|
|
|
|
|
|
|
cp $source_dir/photon/libc/include/*.h $build_dir/sysroot/usr/include
|
|
|
|
|
|
2020-04-03 19:21:22 +01:00
|
|
|
platform_headers=$(find $source_dir/photon/libc/sys/$platform \
|
|
|
|
|
-maxdepth 1 -type f \( -iname "*.h" ! -iname "__*" \))
|
|
|
|
|
platform_sys_headers=$(find $source_dir/photon/libc/sys/$platform/sys \
|
|
|
|
|
-maxdepth 1 -type f \( -iname "*.h" ! -iname "__*" \))
|
|
|
|
|
platform_sys_arch_headers=$(find $source_dir/photon/libc/sys/$platform/machine/$machine \
|
|
|
|
|
-maxdepth 1 -type f \( -iname "*.h" ! -iname "__*" \))
|
2020-05-01 20:39:22 +01:00
|
|
|
|
|
|
|
|
if [ ! -z "$platform_headers" ]; then
|
|
|
|
|
cp -t $build_dir/sysroot/usr/include $platform_headers
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ ! -z "$platform_sys_headers" ]; then
|
|
|
|
|
cp -t $build_dir/sysroot/usr/include/sys $platform_sys_headers
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ ! -z "$platform_sys_arch_headers" ]; then
|
|
|
|
|
cp -t $build_dir/sysroot/usr/include/sys $platform_sys_arch_headers
|
|
|
|
|
fi
|
2020-03-31 16:21:07 +01:00
|
|
|
|
|
|
|
|
machine_arch_headers=$(find $source_dir/photon/libc/machine/$machine/ \
|
|
|
|
|
-type f \( -iname "*.h" ! -iname "__*" \))
|
|
|
|
|
machine_generic_headers=$(find $source_dir/photon/libc/include/machine/ \
|
|
|
|
|
-type f \( -iname "*.h" ! -iname "__*" \))
|
2020-05-01 20:39:22 +01:00
|
|
|
|
|
|
|
|
if [ ! -z "$machine_generic_headers" ]; then
|
|
|
|
|
cp -t $build_dir/sysroot/usr/include/machine $machine_generic_headers
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ ! -z "$machine_arch_headers" ]; then
|
|
|
|
|
cp -t $build_dir/sysroot/usr/include/machine $machine_arch_headers
|
|
|
|
|
fi
|