add_new_package.wizard 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #!/bin/sh
  2. echo "**** Autotools Add New Package Wizard ****"
  3. echo " This script will generate files to add a"
  4. echo " new package to buildroot."
  5. echo
  6. echo "What is the name of the package?"
  7. read PACKAGE_NAME
  8. echo "What is the version number?"
  9. read VERSION_NUM
  10. echo "What is the web address of the tarball?"
  11. read DOWNLOAD_LOC
  12. echo "Enter any known dependencies, separated"
  13. echo "by spaces, or just press enter."
  14. read EXTRA_DEPS
  15. echo "Enter a description of the package."
  16. read DESCRIPTION
  17. echo "Does autoreconf need to be run first? (y/n)"
  18. read ANSWER
  19. if [ "$ANSWER" = "y" ]; then
  20. RECONF="YES"
  21. else
  22. RECONF="NO"
  23. fi
  24. echo "Does it need to be installed to the staging dir?"
  25. echo "Say yes, if other packages depend on it."
  26. echo "(If not sure, just say yes. It will only use more"
  27. echo "space on your hard drive.)"
  28. read ANSWER
  29. if [ "$ANSWER" = "y" ]; then
  30. STAGING="YES"
  31. else
  32. STAGING="NO"
  33. fi
  34. echo "Enter any configure script options."
  35. read CONFIG_OPTIONS
  36. URL=${DOWNLOAD_LOC%/*}
  37. TARBALL=${DOWNLOAD_LOC##*/}
  38. EXTENSION=${TARBALL##*.tar.}
  39. NAME_UPPER=`echo ${PACKAGE_NAME} | tr [a-z] [A-Z]`
  40. NAME_UPPER=${NAME_UPPER//-/_}
  41. mkdir ../package/${PACKAGE_NAME}
  42. cat > ../package/${PACKAGE_NAME}/${PACKAGE_NAME}.mk <<EOF
  43. #############################################################
  44. #
  45. # ${PACKAGE_NAME}
  46. #
  47. #############################################################
  48. ${NAME_UPPER}_VERSION = ${VERSION_NUM}
  49. ${NAME_UPPER}_SOURCE = ${PACKAGE_NAME}-\$(${NAME_UPPER}_VERSION).tar.${EXTENSION}
  50. ${NAME_UPPER}_SITE = ${URL}
  51. ${NAME_UPPER}_AUTORECONF = ${RECONF}
  52. ${NAME_UPPER}_INSTALL_STAGING = ${STAGING}
  53. ${NAME_UPPER}_INSTALL_TARGET = YES
  54. ${NAME_UPPER}_CONF_OPT = ${CONFIG_OPTIONS}
  55. ${NAME_UPPER}_DEPENDENCIES = uclibc ${EXTRA_DEPS}
  56. \$(eval \$(call AUTOTARGETS,package,${PACKAGE_NAME}))
  57. EOF
  58. cat > ../package/${PACKAGE_NAME}/Config.in <<EOF
  59. config BR2_PACKAGE_${NAME_UPPER}
  60. bool "${PACKAGE_NAME}"
  61. default n
  62. help
  63. ${DESCRIPTION}
  64. ${URL}
  65. EOF
  66. echo "Just add: source \"package/${PACKAGE_NAME}/Config.in\""
  67. echo "to the file package/Config.in in an appropriate"
  68. echo "location."
  69. echo
  70. echo "You are now ready to build ${PACKAGE_NAME}"
  71. echo "Just run make menuconfig and select your new"
  72. echo "package, then run make."