libarchive: remove xz dependency
[openadk.git] / scripts / create-menu
blob1a2aab3d045494d60ca471b31ea17a27c3b4c102
1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
4 topdir=$(readlink -nf $(dirname $0)/.. 2>/dev/null || (cd $(dirname $0)/..; pwd -P))
5 systems=$(grep -h config target/*/systems/*|cut -d " " -f 2)
7 printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.arch
8 printf "source target/config/Config.in.arch.default\n" >> target/config/Config.in.arch
9 printf "source target/config/Config.in.arch.choice\n" >> target/config/Config.in.arch
10 printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.system
11 printf "source target/config/Config.in.system.default\n" >> target/config/Config.in.system
12 printf "source target/config/Config.in.system.choice\n" >> target/config/Config.in.system
14 # update tasks
15 if [ -d "$topdir/tasks" -o -n "$ADK_CUSTOM_TASKS_DIR" ];then
16         printf "# autogenerated via scripts/create-menu\n" > $topdir/target/config/Config.in.tasks
17         printf "menu \"Tasks\"\n" >> $topdir/target/config/Config.in.tasks
18         printf "\tvisible if ADK_TARGET_OS_LINUX && !ADK_TARGET_CHOOSE_ARCH\n\n" >> $topdir/target/config/Config.in.tasks
20         if [ -d "$topdir/tasks" ];then
21                 cat $topdir/tasks/* >> $topdir/target/config/Config.in.tasks 2>/dev/null
22         fi
23         if [ -n "$ADK_CUSTOM_TASKS_DIR" -a -d "$ADK_CUSTOM_TASKS_DIR" ];then
24                 printf "\n# tasks pulled from ADK_CUSTOM_TASKS_DIR='%s'\n" "$ADK_CUSTOM_TASKS_DIR" >> $topdir/target/config/Config.in.tasks
25                 cat $ADK_CUSTOM_TASKS_DIR/* >> $topdir/target/config/Config.in.tasks 2>/dev/null
26         fi
27         printf "\nendmenu\n\n" >> $topdir/target/config/Config.in.tasks
30 # create system default
31 printf "# autogenerated via scripts/create-menu\n" > $topdir/target/config/Config.in.system.default
33 cat >> $topdir/target/config/Config.in.system.default << EOD
34 config ADK_TARGET_SYSTEM
35         string
36 EOD
37 for i in $systems;do
38         system=${i#ADK_TARGET_SYSTEM_}
39         systemu=$(echo $system|tr '[:upper:]' '[:lower:]')
40         system=$(echo $system|tr '[:upper:]_' '[:lower:]-')
41         system=$(echo $system|sed 's#x86-64#x86_64#')
42         printf "\tdefault \"${system}\" if $i\n" >> $topdir/target/config/Config.in.system.default
43 done
45 # create or update systems
46 for arch in $(cat $topdir/target/arch.lst);do
47         ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
48         printf "config ADK_TARGET_SYSTEM_GENERIC_$ARCH\n" > $topdir/target/$arch/Config.in.systems
49         printf "\tbool \"Generic\"\n" >> $topdir/target/$arch/Config.in.systems
50         printf "\tselect ADK_TARGET_GENERIC\n" >> $topdir/target/$arch/Config.in.systems
51         printf "\thelp\n" >> $topdir/target/$arch/Config.in.systems
52         printf "\t  Generic $ARCH system.\n\n" >> $topdir/target/$arch/Config.in.systems
53         printf "\tdefault \"generic-${arch}\" if ADK_TARGET_SYSTEM_GENERIC_$ARCH\n" >> $topdir/target/config/Config.in.system.default
54 done
56 for i in $(ls $topdir/target/);do
57         if [ -d "$topdir/target/$i/systems" ];then
58                 cat $topdir/target/$i/systems/* >> $topdir/target/$i/Config.in.systems 2>/dev/null
59         fi
60 done
62 # create target/$arch/Config.in.arch and target/config/Config.in.system.choice
63 printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.system.choice
64 printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.arch.default
65 for arch in $(cat $topdir/target/arch.lst);do
66         ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
67         printf "choice\n" > $topdir/target/$arch/Config.in.arch
68         printf "prompt \"System\"\n" >> $topdir/target/$arch/Config.in.arch
69         printf "depends on ADK_TARGET_ARCH_$ARCH\n" >> $topdir/target/$arch/Config.in.arch
70         printf "source target/$arch/Config.in.systems\n" >> $topdir/target/$arch/Config.in.arch
71         printf "endchoice\n" >> $topdir/target/$arch/Config.in.arch
72         printf "source target/$arch/Config.in.arch\n" >> target/config/Config.in.system.choice
73 done
75 cat >> $topdir/target/config/Config.in.arch.default << EOD
76 config ADK_TARGET_ARCH
77         string
78 EOD
80 for arch in $(cat $topdir/target/arch.lst);do
81   ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
82   printf "\tdefault \"$arch\" if ADK_TARGET_ARCH_$ARCH\n" >> target/config/Config.in.arch.default
83 done
84 printf "\n\n" >> target/config/Config.in.arch.default
86 for arch in $(cat $topdir/target/arch.lst);do
87   ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
88   printf "config ADK_TARGET_ARCH_${ARCH}\n" >> $topdir/target/config/Config.in.arch.default
89   printf "\tbool\n\n" >> $topdir/target/config/Config.in.arch.default
90 done
92 cat > $topdir/target/config/Config.in.arch.choice << EOD
93 # autogenerated via scripts/create-menu
94 choice
95 prompt "Architecture"
97 config ADK_TARGET_CHOOSE_ARCH
98         bool "choose architecture"
101 for os in linux baremetal; do
102   for arch in $(cat $topdir/target/$os/arch.lst);do
103     OS=$(echo $os | tr '[:lower:]' '[:upper:]')
104     ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
105     printf "config ADK_TARGET_${OS}_ARCH_${ARCH}\n" >> $topdir/target/config/Config.in.arch.choice
106     printf "\tbool \"$arch\"\n" >> $topdir/target/config/Config.in.arch.choice
107     printf "\tdepends on ADK_TARGET_OS_${OS}\n" >> $topdir/target/config/Config.in.arch.choice
108     printf "\tselect ADK_TARGET_ARCH_${ARCH}\n" >> $topdir/target/config/Config.in.arch.choice
109     printf "\thelp\n" >> $topdir/target/config/Config.in.arch.choice
110     printf "\t  Support for $ARCH systems.\n\n" >> $topdir/target/config/Config.in.arch.choice
111   done
112 done
113 printf "endchoice\n" >> $topdir/target/config/Config.in.arch.choice
115 exit 0