mkconfigs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #!/bin/sh
  2. #
  3. # Copyright (C) 2002 Khalid Aziz <khalid_aziz at hp.com>
  4. # Copyright (C) 2002 Randy Dunlap <rddunlap at osdl.org>
  5. # Copyright (C) 2002 Al Stone <ahs3 at fc.hp.com>
  6. # Copyright (C) 2002 Hewlett-Packard Company
  7. #
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. #
  22. # Busybox version by Matteo Croce <3297627799 at wind.it>
  23. #
  24. # Rules to generate bbconfigopts.h from .config:
  25. # - Retain lines that begin with "CONFIG_"
  26. # - Retain lines that begin with "# CONFIG_"
  27. # - lines that use double-quotes must \\-escape-quote them
  28. config=.config
  29. od -v -b </dev/null >/dev/null
  30. if test $? != 0; then
  31. echo 'od tool is not installed or cannot accept "-v -b" options'
  32. exit 1
  33. fi
  34. bzip2 </dev/null >/dev/null
  35. if test $? != 0; then
  36. echo 'bzip2 is not installed'
  37. exit 1
  38. fi
  39. {
  40. echo "\
  41. #ifndef _BBCONFIGOPTS_H
  42. #define _BBCONFIGOPTS_H
  43. /*
  44. * busybox configuration settings.
  45. *
  46. * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  47. *
  48. * This file is generated automatically by scripts/mkconfigs.
  49. * Do not edit.
  50. */
  51. static const char bbconfig_config[] ALIGN1 ="
  52. grep -e '^# CONFIG_' -e '^CONFIG_' "$config" \
  53. | sed -e 's/\"/\\\"/g' -e 's/^/"/' -e 's/$/\\n"/'
  54. echo ";"
  55. echo "#endif"
  56. } >"$1"
  57. {
  58. echo "\
  59. #ifndef _BBCONFIGOPTS_BZ2_H
  60. #define _BBCONFIGOPTS_BZ2_H
  61. /*
  62. * busybox configuration settings.
  63. *
  64. * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  65. *
  66. * This file is generated automatically by scripts/mkconfigs.
  67. * Do not edit.
  68. */
  69. static const char bbconfig_config_bz2[] ALIGN1 = {"
  70. grep -e '^# CONFIG_' -e '^CONFIG_' "$config" \
  71. | bzip2 -1 | dd bs=2 skip=1 2>/dev/null \
  72. | od -v -b \
  73. | sed -e 's/^[^ ]*//' \
  74. -e 's/ //g' \
  75. -e '/^$/d' \
  76. -e 's/\(...\)/0\1,/g'
  77. echo "};"
  78. echo "#endif"
  79. } >"$2"