aboutsummaryrefslogtreecommitdiff
blob: 9ee0ce119721e5d87f4c82285065bc2e24421c59 (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
#!/bin/bash

# Copyright (c) 2002
# John Stalker
# Department of Mathematics
# Princeton University

echo
echo -e "\x1b[31;01m!!! As of Gentoolkit 0.2.0, this tool is deprecated"
echo -e "!!!\x1b[0;0m Refer to app-portage/ebuilder for a replacement."
echo 

CONFIG_FILE=${HOME}/.mkebuild
if [ -e $CONFIG_FILE ]
then
        source $CONFIG_FILE
else
        echo This appears to be the first time you have used mkebuild.
        echo I am going to make some guesses.  If any of these are wrong
        echo you should edit the file ${CONFIG_FILE}.
        echo
        MY_NAME=`awk -F":" '/^'${USER}:'/ { print $5 }' /etc/passwd`
        echo Your name is ${MY_NAME}.
        echo 'MY_NAME="'${MY_NAME}'"' >${CONFIG_FILE}
        COPYRIGHT="Gentoo Technologies, Inc."
        echo You wish to asign copyright to ${COPYRIGHT}
        echo 'COPYRIGHT="'${COPYRIGHT}'"' >>${CONFIG_FILE}
        MY_EMAIL=${USER}"@"${HOSTNAME}
        echo Your email address is ${MY_EMAIL}.
        echo 'MY_EMAIL='${MY_EMAIL} >>$CONFIG_FILE
        LICENSE="the GNU General Public License, v2"
        echo Your preferred license is ${LICENSE}.
        echo 'LICENSE="'${LICENSE}'"' >>${CONFIG_FILE}
        LOCAL_SOURCE=${HOME}
        echo You download sources to ${LOCAL_SOURCE}.
        echo LOCAL_SOURCE=${LOCAL_SOURCE} >>${CONFIG_FILE}
        BUILD_DIRECTORY=${HOME}
        echo You build packages in ${BUILD_DIRECTORY}.
        echo 'BUILD_DIRECTORY='${BUILD_DIRECTORY} >>${CONFIG_FILE}
        echo
fi
FILE_NAME=`basename $1`
SOURCE_LOCATION=`dirname $1`
PACKAGE_NAME=${FILE_NAME%.*}
FILE_EXTENSION=${FILE_NAME##*.}
if [ "${PACKAGE_NAME##*.}" = "tar" ]
then
        FILE_EXTENSION=tar.${FILE_EXTENSION}
        PACKAGE_NAME=${PACKAGE_NAME%.tar}
fi
EBUILD_FILE=${PWD}/${PACKAGE_NAME}.ebuild
echo "# Copyright" `date +"%Y"` ${COPYRIGHT} >${EBUILD_FILE}
echo "# Distributed under the terms of" ${LICENSE} >>${EBUILD_FILE}
#echo "# Author" ${MY_NAME} '<'${MY_EMAIL}'>' >>${EBUILD_FILE}
echo "# \$Header$" >>${EBUILD_FILE}
echo >>${EBUILD_FILE}
echo 'DESCRIPTION=""' >>${EBUILD_FILE}
echo 'SRC_URI="'${SOURCE_LOCATION}'/${P}.'${FILE_EXTENSION}'"' >>${EBUILD_FILE}
echo 'HOMEPAGE="'${SOURCE_LOCATION}'/"' >>${EBUILD_FILE}
echo 'LICENSE=""' >>${EBUILD_FILE}
echo 'SLOT="0"' >>${EBUILD_FILE}
echo 'KEYWORDS="~x86"' >>${EBUILD_FILE}
echo 'IUSE=""' >>${EBUILD_FILE}
echo >>${EBUILD_FILE}
echo 'DEPEND=""' >>${EBUILD_FILE}
echo >>${EBUILD_FILE}
echo '#RDEPEND=""' >>${EBUILD_FILE}
echo 'S=${WORKDIR}/${P}' >>${EBUILD_FILE}
echo >>${EBUILD_FILE}
echo 'src_unpack() {' >>${EBUILD_FILE}
echo >>${EBUILD_FILE}
echo -e "\t"'unpack ${A}' >>${EBUILD_FILE}
echo -e "\t"'cd ${S}' >>${EBUILD_FILE}
echo >>${EBUILD_FILE}
echo '}' >>${EBUILD_FILE}
if [ -e ${LOCAL_SOURCE}/${FILE_NAME} ]
then
        echo I am assuming that $1 really 
        echo exists and that ${LOCAL_SOURCE}/${FILE_NAME}
        echo is a faithful copy.
else
        echo I didn\'t find ${LOCAL_SOURCE}/${FILE_NAME} so I will fetch
        echo $1.
        cd ${LOCAL_SOURCE}
        wget $1
fi
if [ -e ${BUILD_DIRECTORY}/${PACKAGE_NAME} ]
then
        echo
        echo I am assuming that ${BUILD_DIRECTORY}/${PACKAGE_NAME} \
                is the unpacked
        echo version of ${LOCAL_SOURCE}/${FILE_NAME}.
else
        cd ${BUILD_DIRECTORY}
        if [ $? -ne 0 ]
        then
                echo
                echo I was unable to enter the directory ${BUILD_DIRECTORY}.
                exit 1
        fi
        case "${FILE_EXTENSION}" in
                tar.gz|tgz)
                        tar xzf ${LOCAL_SOURCE}/${FILE_NAME}
                        ;;
                tar.bz2|tbz2)
                        tar xjf ${LOCAL_SOURCE}/${FILE_NAME}
                        ;;
                tar.Z|tar.z)
                        unzip ${LOCAL_SOURCE}/${FILE_NAME}
                        tar xf ${PACKAGE_NAME}.tar
                        ;;
                *)
                        echo
                        echo I can\'t figure out how to uncompress
                        echo ${LOCAL_SOURCE}/${FILE_NAME}
                        exit 1
        esac
        if [ $? -ne 0 ]
        then
                echo
                echo I was unable to uncompress ${LOCAL_SOURCE}/${FILE_NAME}.
                exit 1
        fi
fi
cd ${BUILD_DIRECTORY}/${PACKAGE_NAME}
if [ $? -ne 0 ]
then
        echo
        echo I could not change directory to ${BUILD_DIRECTORY}/${PACKAGE_NAME}
        exit 1
fi
echo
echo You might want to look at the following files for configuration and
echo dependency information:
find ${PWD} -name README -print
find ${PWD} -name README.txt -print
find ${PWD} -name INSTALL -print
find ${PWD} -name INSTALL.txt -print
find ${PWD} -name Changes -print
find ${PWD} -name CHANGES.txt -print
find ${PWD} -name FAQ.txt
find ${PWD} -name ChangeLog -print
find ${PWD} -name NEWS -print
echo >>${EBUILD_FILE}
echo 'src_compile() {' >>${EBUILD_FILE}
echo >>${EBUILD_FILE}
echo
if [ -e Imakefile ]
then
        echo I found an Imakefile.  I am assuming that we should use xmkmf.
        echo I don\'t really understand xmkmf so you will have to configure
        echo things on your own.
        echo
        echo -e "\t"'xmkmf || die' >>${EBUILD_FILE}
        echo -e "\tmake Makefiles" >>${EBUILD_FILE}
        echo -e "\tmake includes" >>${EBUILD_FILE}
        echo -e "\tmake depend" >>${EBUILD_FILES}
elif [ -e configure ]
then
        echo I found a configure file.  I am assuming that we are using autoconf
.
        echo I will take care of setting the most commonly used options.  I am
        echo including a list of all the available options to confiigure, commen
ted
        echo out.  You might want to look it over to see if I have missed anythi
ng.
        echo
        ./configure --help >.config.options
        echo -e "\t./configure \\" >>${EBUILD_FILE}
        awk '/--prefix/ { print "\t\t--prefix=/usr \\"}' \
                .config.options >>${EBUILD_FILE}
        awk '/--infodir/ { print "\t\t--infodir=/usr/share/info \\"}' \
                .config.options >>${EBUILD_FILE}
        awk '/--mandir/ { print "\t\t--mandir=/usr/share/man \\"}' \
                .config.options >>${EBUILD_FILE}
        echo -e "\t\t"'|| die "./configure failed"' >>${EBUILD_FILE}
        echo -e "#\tAvailable options to configure:" >>${EBUILD_FILE}
        awk '/--/ { print "#" $0 }' .config.options >>${EBUILD_FILE}
        echo -e "\t"'emake || die' >>${EBUILD_FILE}
elif [ -e Makefile ]
then
        echo I found a Makefile.  You should look at it and possibly prepare
        echo a patch.
        echo
        echo -e "\temake || die" >>${EBUILD_FILE}
else
        echo I couldn\'t find a Imakefile, configure script, or Makefile for
        echo this package.  You will have to figure out what to do on your
        echo own.
        echo
fi
echo '}' >>${EBUILD_FILE}
echo >>${EBUILD_FILE}
echo 'src_install () {' >>${EBUILD_FILE}
echo >>${EBUILD_FILE}
echo -e "\t"'make DESTDIR=${D} install || die' >>${EBUILD_FILE}
echo '}' >>${EBUILD_FILE}
echo >>${EBUILD_FILE}
echo >>${EBUILD_FILE}
echo >>${EBUILD_FILE}
echo I couldn\'t supply a package description for the ebuild file
echo because I don\'t know what ${PACKAGE_NAME} does.
echo
echo I am assume the hompage for this package is ${SOURCE_LOCATION}/.
echo If that is not correct you will need to edit that portion of
echo the ebuild file as well.
echo
echo I don\'t understand dependencies yet.  You will have to add any
echo dependencies you know of by hand.  Then try your ebuild script
echo out to see if there are any dependencies you don\'t know of.
echo
echo I am assuming that this package comes with a well-behaved Makefile
echo which does not install anything outside of '${DESTDIR}'.  You will
echo need to check this by looking at the portion of the Makefile
echo beginning with the line '"install:"'.