add_new_package.wizard 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 an additional subdirectory below package/"
  35. echo "as category, or just press enter."
  36. read SUB_DIR
  37. if [ -z "$SUB_DIR" ]; then
  38. CATEGORY_DIR=package
  39. else
  40. CATEGORY_DIR=package/${SUB_DIR}
  41. fi
  42. echo "Enter any configure script options."
  43. read CONFIG_OPTIONS
  44. URL=${DOWNLOAD_LOC%/*}
  45. TARBALL=${DOWNLOAD_LOC##*/}
  46. EXTENSION=${TARBALL##*.tar.}
  47. NAME_UPPER=`echo ${PACKAGE_NAME} | tr a-z- A-Z_`
  48. PACKAGE_DIR=`dirname $0`/../${CATEGORY_DIR}/${PACKAGE_NAME}
  49. mkdir -p ${PACKAGE_DIR}
  50. sed -e 's/ *$//g' > ${PACKAGE_DIR}/${PACKAGE_NAME}.mk <<EOF
  51. #############################################################
  52. #
  53. # ${PACKAGE_NAME}
  54. #
  55. #############################################################
  56. ${NAME_UPPER}_VERSION = ${VERSION_NUM}
  57. ${NAME_UPPER}_SOURCE = ${PACKAGE_NAME}-\$(${NAME_UPPER}_VERSION).tar.${EXTENSION}
  58. ${NAME_UPPER}_SITE = ${URL}
  59. ${NAME_UPPER}_AUTORECONF = ${RECONF}
  60. ${NAME_UPPER}_INSTALL_STAGING = ${STAGING}
  61. ${NAME_UPPER}_INSTALL_TARGET = YES
  62. ${NAME_UPPER}_CONF_OPT = ${CONFIG_OPTIONS}
  63. ${NAME_UPPER}_DEPENDENCIES = uclibc ${EXTRA_DEPS}
  64. \$(eval \$(call AUTOTARGETS,${CATEGORY_DIR},${PACKAGE_NAME}))
  65. EOF
  66. cat > ${PACKAGE_DIR}/Config.in <<EOF
  67. config BR2_PACKAGE_${NAME_UPPER}
  68. bool "${PACKAGE_NAME}"
  69. help
  70. ${DESCRIPTION}
  71. ${URL}
  72. EOF
  73. echo
  74. echo "**** Manual steps to integrate your new package ****"
  75. echo
  76. echo "Add the following line to ${CATEGORY_DIR}/Config.in"
  77. echo "in an appropriate location:"
  78. echo "source \"${CATEGORY_DIR}/${PACKAGE_NAME}/Config.in\""
  79. if [ -n "$SUB_DIR" ]; then
  80. echo
  81. echo "Additionally add the following line to package/Config.in"
  82. echo "in an appropriate location:"
  83. echo "source \"${CATEGORY_DIR}/Config.in\""
  84. fi
  85. if [ -n "$EXTRA_DEPS" ]; then
  86. echo
  87. echo "You need to add \"depends on\" and/or \"select\" lines"
  88. echo "to ${CATEGORY_DIR}/${PACKAGE_NAME}/Config.in"
  89. echo "corresponding to the \"${NAME_UPPER}_DEPENDENCIES\" line"
  90. echo "in ${CATEGORY_DIR}/${PACKAGE_NAME}/${PACKAGE_NAME}.mk"
  91. fi
  92. echo
  93. echo "After that run \"make menuconfig\", select your new package"
  94. echo "and run \"make\" to build \"${PACKAGE_NAME}\"."