summaryrefslogtreecommitdiff
path: root/scripts/add_new_package.wizard
blob: d4127f4228dd77151c59d13adfc6a84c125e7657 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/sh

echo "**** Autotools Add New Package Wizard ****"
echo " This script will generate files to add a"
echo " new package to buildroot."
echo

echo "What is the name of the package?"
read PACKAGE_NAME

echo "What is the version number?"
read VERSION_NUM

echo "What is the web address of the tarball?"
read DOWNLOAD_LOC

echo "Enter any known dependencies, separated"
echo "by spaces, or just press enter."
read EXTRA_DEPS

echo "Enter a description of the package."
read DESCRIPTION

echo "Does autoreconf need to be run first? (y/n)"
read ANSWER

if [ "$ANSWER" = "y" ]; then
	RECONF="YES"
else
	RECONF="NO"
fi

echo "Does it need to be installed to the staging dir?"
echo "Say yes, if other packages depend on it."
echo "(If not sure, just say yes. It will only use more"
echo "space on your hard drive.)"
read ANSWER

if [ "$ANSWER" = "y" ]; then
	STAGING="YES"
else
	STAGING="NO"
fi

echo "Enter any configure script options."
read CONFIG_OPTIONS

URL=${DOWNLOAD_LOC%/*}
TARBALL=${DOWNLOAD_LOC##*/}
EXTENSION=${TARBALL##*.tar.}
NAME_UPPER=`echo ${PACKAGE_NAME} | tr a-z- A-Z_`
PACKAGE_DIR=`dirname $0`/../package/${PACKAGE_NAME}

mkdir ${PACKAGE_DIR}

sed -e 's/ *$//g' > ${PACKAGE_DIR}/${PACKAGE_NAME}.mk <<EOF
#############################################################
#
# ${PACKAGE_NAME}
#
#############################################################
${NAME_UPPER}_VERSION = ${VERSION_NUM}
${NAME_UPPER}_SOURCE = ${PACKAGE_NAME}-\$(${NAME_UPPER}_VERSION).tar.${EXTENSION}
${NAME_UPPER}_SITE = ${URL}
${NAME_UPPER}_AUTORECONF = ${RECONF}
${NAME_UPPER}_INSTALL_STAGING = ${STAGING}
${NAME_UPPER}_INSTALL_TARGET = YES

${NAME_UPPER}_CONF_OPT = ${CONFIG_OPTIONS}

${NAME_UPPER}_DEPENDENCIES = uclibc ${EXTRA_DEPS}

\$(eval \$(call AUTOTARGETS,package,${PACKAGE_NAME}))
EOF

cat > ${PACKAGE_DIR}/Config.in <<EOF
config BR2_PACKAGE_${NAME_UPPER}
	bool "${PACKAGE_NAME}"
	help
	  ${DESCRIPTION}

	  ${URL}
EOF

echo "Just add: source \"package/${PACKAGE_NAME}/Config.in\""
echo "to the file package/Config.in in an appropriate"
echo "location."
echo
echo "You are now ready to build ${PACKAGE_NAME}"
echo "Just run make menuconfig and select your new"
echo "package, then run make."