Merge branch 'qtopia-fixes' of git://git.busybox.net/~tpetazzoni/git/buildroot
[avatt.git] / scripts / add_new_package.wizard
blob4ee02dfb2a18b32245dae56a39be1dd1d8ac4aeb
1 #!/bin/sh
3 echo "**** Autotools Add New Package Wizard ****"
4 echo " This script will generate files to add a"
5 echo " new package to buildroot."
6 echo
8 echo "What is the name of the package?"
9 read PACKAGE_NAME
11 echo "What is the version number?"
12 read VERSION_NUM
14 echo "What is the web address of the tarball?"
15 read DOWNLOAD_LOC
17 echo "Enter any known dependencies, separated"
18 echo "by spaces, or just press enter."
19 read EXTRA_DEPS
21 echo "Enter a description of the package."
22 read DESCRIPTION
24 echo "Does autoreconf need to be run first? (y/n)"
25 read ANSWER
27 if [ "$ANSWER" = "y" ]; then
28 RECONF="YES"
29 else
30 RECONF="NO"
33 echo "Does it need to be installed to the staging dir?"
34 echo "Say yes, if other packages depend on it."
35 echo "(If not sure, just say yes. It will only use more"
36 echo "space on your hard drive.)"
37 read ANSWER
39 if [ "$ANSWER" = "y" ]; then
40 STAGING="YES"
41 else
42 STAGING="NO"
45 echo "Enter an additional subdirectory below package/"
46 echo "as category, or just press enter."
47 read SUB_DIR
49 if [ -z "$SUB_DIR" ]; then
50 CATEGORY_DIR=package
51 else
52 CATEGORY_DIR=package/${SUB_DIR}
55 echo "Enter any configure script options."
56 read CONFIG_OPTIONS
58 URL=${DOWNLOAD_LOC%/*}
59 TARBALL=${DOWNLOAD_LOC##*/}
60 EXTENSION=${TARBALL##*.tar.}
61 NAME_UPPER=`echo ${PACKAGE_NAME} | tr a-z- A-Z_`
62 PACKAGE_DIR=`dirname $0`/../${CATEGORY_DIR}/${PACKAGE_NAME}
64 mkdir -p ${PACKAGE_DIR}
66 sed -e 's/ *$//g' > ${PACKAGE_DIR}/${PACKAGE_NAME}.mk <<EOF
67 #############################################################
69 # ${PACKAGE_NAME}
71 #############################################################
72 ${NAME_UPPER}_VERSION = ${VERSION_NUM}
73 ${NAME_UPPER}_SOURCE = ${PACKAGE_NAME}-\$(${NAME_UPPER}_VERSION).tar.${EXTENSION}
74 ${NAME_UPPER}_SITE = ${URL}
75 ${NAME_UPPER}_AUTORECONF = ${RECONF}
76 ${NAME_UPPER}_INSTALL_STAGING = ${STAGING}
77 ${NAME_UPPER}_INSTALL_TARGET = YES
79 ${NAME_UPPER}_CONF_OPT = ${CONFIG_OPTIONS}
81 ${NAME_UPPER}_DEPENDENCIES = uclibc ${EXTRA_DEPS}
83 \$(eval \$(call AUTOTARGETS,${CATEGORY_DIR},${PACKAGE_NAME}))
84 EOF
86 cat > ${PACKAGE_DIR}/Config.in <<EOF
87 config BR2_PACKAGE_${NAME_UPPER}
88 bool "${PACKAGE_NAME}"
89 help
90 ${DESCRIPTION}
92 ${URL}
93 EOF
95 echo
96 echo "**** Manual steps to integrate your new package ****"
97 echo
99 echo "Add the following line to ${CATEGORY_DIR}/Config.in"
100 echo "in an appropriate location:"
101 echo "source \"${CATEGORY_DIR}/${PACKAGE_NAME}/Config.in\""
103 if [ -n "$SUB_DIR" ]; then
104 echo
105 echo "Additionally add the following line to package/Config.in"
106 echo "in an appropriate location:"
107 echo "source \"${CATEGORY_DIR}/Config.in\""
110 if [ -n "$EXTRA_DEPS" ]; then
111 echo
112 echo "You need to add \"depends on\" and/or \"select\" lines"
113 echo "to ${CATEGORY_DIR}/${PACKAGE_NAME}/Config.in"
114 echo "corresponding to the \"${NAME_UPPER}_DEPENDENCIES\" line"
115 echo "in ${CATEGORY_DIR}/${PACKAGE_NAME}/${PACKAGE_NAME}.mk"
118 echo
119 echo "After that run \"make menuconfig\", select your new package"
120 echo "and run \"make\" to build \"${PACKAGE_NAME}\"."