create-menu 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #!/usr/bin/env bash
  2. # This file is part of the OpenADK project. OpenADK is copyrighted
  3. # 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)
  6. printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.arch
  7. printf "source target/config/Config.in.arch.default\n" > target/config/Config.in.arch
  8. printf "source target/config/Config.in.arch.choice\n" >> target/config/Config.in.arch
  9. printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.system
  10. printf "source target/config/Config.in.system.default\n" >> target/config/Config.in.system
  11. printf "source target/config/Config.in.system.choice\n" >> target/config/Config.in.system
  12. # update package collection
  13. if [ -d "$topdir/target/collections" ];then
  14. printf "# autogenerated via scripts/create-menu\n" > $topdir/package/Config.in.collections
  15. cat $topdir/target/collections/* >> $topdir/package/Config.in.collections 2>/dev/null
  16. fi
  17. # create system default
  18. printf "# autogenerated via scripts/create-menu\n" > $topdir/target/config/Config.in.system.default
  19. for j in $systems;do
  20. system=${j#ADK_TARGET_SYSTEM_}
  21. systemu=$(echo $system|tr '[:upper:]' '[:lower:]')
  22. printf "config ADK_$systemu\n" >> $topdir/target/config/Config.in.system.default
  23. printf "\tboolean\n\n" >> $topdir/target/config/Config.in.system.default
  24. done
  25. cat >> $topdir/target/config/Config.in.system.default << EOD
  26. config ADK_TARGET_SYSTEM
  27. string
  28. EOD
  29. for i in $systems;do
  30. system=${i#ADK_TARGET_SYSTEM_}
  31. systemu=$(echo $system|tr '[:upper:]' '[:lower:]')
  32. system=$(echo $system|tr '[:upper:]_' '[:lower:]-')
  33. system=$(echo $system|sed 's#x86-64#x86_64#')
  34. printf "\tdefault \"${system}\" if ADK_$systemu\n" >> $topdir/target/config/Config.in.system.default
  35. done
  36. # create or update systems
  37. for i in $(ls $topdir/target/);do
  38. if [ -d "$topdir/target/$i/systems" ];then
  39. cat $topdir/target/$i/systems/* > $topdir/target/$i/Config.in.systems 2>/dev/null
  40. fi
  41. done
  42. # create target/$arch/Config.in.arch and target/config/Config.in.system.choice
  43. printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.system.choice
  44. printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.arch.default
  45. for arch in $(cat $topdir/target/arch.lst);do
  46. ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
  47. printf "choice\n" > $topdir/target/$arch/Config.in.arch
  48. printf "depends on ADK_LINUX_$ARCH && !ADK_CHOOSE_TARGET_ARCH\n" >> $topdir/target/$arch/Config.in.arch
  49. printf "prompt \"Target system\"\n\n" >> $topdir/target/$arch/Config.in.arch
  50. printf "config ADK_CHOOSE_TARGET_SYSTEM_$ARCH\n" >> $topdir/target/$arch/Config.in.arch
  51. printf "\tboolean \"Choose target system\"\n\n" >> $topdir/target/$arch/Config.in.arch
  52. printf "source target/$arch/Config.in.systems\n" >> $topdir/target/$arch/Config.in.arch
  53. printf "endchoice\n" >> $topdir/target/$arch/Config.in.arch
  54. printf "source target/$arch/Config.in.arch\n" >> target/config/Config.in.system.choice
  55. printf "config ADK_$arch\n" >> target/config/Config.in.arch.default
  56. printf "\tboolean\n\n" >> target/config/Config.in.arch.default
  57. done
  58. cat >> $topdir/target/config/Config.in.arch.default << EOD
  59. config ADK_TARGET_ARCH
  60. string
  61. EOD
  62. for arch in $(cat $topdir/target/arch.lst);do
  63. printf "\tdefault \"$arch\" if ADK_$arch\n" >> target/config/Config.in.arch.default
  64. done
  65. cat > $topdir/target/config/Config.in.arch.choice << EOD
  66. # autogenerated via scripts/create-menu
  67. choice
  68. prompt "Target architecture"
  69. config ADK_CHOOSE_TARGET_ARCH
  70. bool "Choose target architecture"
  71. EOD
  72. for arch in $(cat $topdir/target/arch.lst);do
  73. ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
  74. printf "config ADK_LINUX_$ARCH\n" >> $topdir/target/config/Config.in.arch.choice
  75. printf "\tprompt \"$arch system\"\n" >> $topdir/target/config/Config.in.arch.choice
  76. printf "\tboolean\n" >> $topdir/target/config/Config.in.arch.choice
  77. printf "\tselect ADK_$arch\n" >> $topdir/target/config/Config.in.arch.choice
  78. printf "\thelp\n" >> $topdir/target/config/Config.in.arch.choice
  79. printf "\t Support for $ARCH systems.\n\n" >> $topdir/target/config/Config.in.arch.choice
  80. done
  81. printf "endchoice\n" >> $topdir/target/config/Config.in.arch.choice
  82. cat > $topdir/target/config/Config.in.system.choose << EOD
  83. # autogenerated via scripts/create-menu
  84. config ADK_CHOOSE_TARGET_SYSTEM
  85. boolean
  86. EOD
  87. for arch in $(cat $topdir/target/arch.lst);do
  88. ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
  89. printf "\tdefault y if ADK_CHOOSE_TARGET_SYSTEM_$ARCH\n" >> $topdir/target/config/Config.in.system.choose
  90. done
  91. printf "\tdefault n\n" >> $topdir/target/config/Config.in.system.choose
  92. exit 0