Added scrip support
This commit is contained in:
@@ -52,7 +52,7 @@ within the package, and should be named with a `.patch` extension. They
|
|||||||
should be "unified" patch files (created with `diff -u`), and will be
|
should be "unified" patch files (created with `diff -u`), and will be
|
||||||
applied to the source code after extraction and before configuration.
|
applied to the source code after extraction and before configuration.
|
||||||
|
|
||||||
||* Script files - (not implemented yet). These should be placed in the
|
* Script files - (not implemented yet). These should be placed in the
|
||||||
`scripts` directory, and referenced in the `PKGCONF` file using the
|
`scripts` directory, and referenced in the `PKGCONF` file using the
|
||||||
variables:
|
variables:
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ variables:
|
|||||||
* `CHECKINSTALL=...`
|
* `CHECKINSTALL=...`
|
||||||
|
|
||||||
They will be included in the final package as the relevant script file
|
They will be included in the final package as the relevant script file
|
||||||
entries.||
|
entries.
|
||||||
|
|
||||||
|
|
||||||
Compiling a Package
|
Compiling a Package
|
||||||
|
|||||||
52
bin/makepkg
52
bin/makepkg
@@ -16,6 +16,7 @@ OS="${OSNAME}-${OSVER}"
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OPT_INSTALL=0
|
OPT_INSTALL=0
|
||||||
OPT_RECURSE=0
|
OPT_RECURSE=0
|
||||||
OPT_FORCE=0
|
OPT_FORCE=0
|
||||||
@@ -63,34 +64,39 @@ HERE=`pwd`
|
|||||||
SRCDIR="${HERE}/src"
|
SRCDIR="${HERE}/src"
|
||||||
DESTDIR="${HERE}/staging"
|
DESTDIR="${HERE}/staging"
|
||||||
PKGDIR="${HERE}/pkg"
|
PKGDIR="${HERE}/pkg"
|
||||||
|
DISTFILES="${HERE}/../../distfiles"
|
||||||
|
|
||||||
export DESTDIR
|
export DESTDIR
|
||||||
|
export DISTFILES
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
URL_PROTO=`echo "$URL" | cut -f1 -d':'`
|
URL_PROTO=`echo "$URL" | cut -f1 -d':'`
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
rm -rf src pkg staging
|
printf "Cleaning up ... src "
|
||||||
|
rm -rf src
|
||||||
|
printf "pkg "
|
||||||
|
rm -rf pkg
|
||||||
|
printf "staging "
|
||||||
|
rm -rf staging
|
||||||
rm -f .download .extract .patchsrc .configure .build .install .package .installpkg
|
rm -f .download .extract .patchsrc .configure .build .install .package .installpkg
|
||||||
|
echo "... done"
|
||||||
}
|
}
|
||||||
|
|
||||||
download() {
|
download() {
|
||||||
|
|
||||||
case $URL_PROTO in
|
case $URL_PROTO in
|
||||||
http|https|ftp)
|
http|https|ftp)
|
||||||
cd "${SRCDIR}"
|
/usr/sfw/bin/wget -c -O "${DISTFILES}/${SRC}" "${URL}"
|
||||||
/usr/sfw/bin/wget -c "${URL}"
|
|
||||||
cd "${HERE}"
|
|
||||||
;;
|
;;
|
||||||
git)
|
git)
|
||||||
P=`echo "${URL}" | cut -f2 -d':'`
|
P=`echo "${URL}" | cut -f2 -d':'`
|
||||||
H=`echo "$P" | cut -f1 -d'@'`
|
H=`echo "$P" | cut -f1 -d'@'`
|
||||||
T=`echo "$P" | cut -f2 -d'@'`
|
T=`echo "$P" | cut -f2 -d'@'`
|
||||||
hook git_clone_pre
|
hook git_clone_pre
|
||||||
cd "${SRCDIR}"
|
git clone --depth 1 --branch "$T" https:$H "${SRCDIR}/${PACKAGE}-${VERSION}"
|
||||||
git clone --depth 1 --branch "$T" https:$H "${PACKAGE}-${VERSION}"
|
|
||||||
hook git_clone_post
|
hook git_clone_post
|
||||||
cd "${HERE}"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -101,7 +107,7 @@ extract() {
|
|||||||
printf "Extracting ${SRC} ... "
|
printf "Extracting ${SRC} ... "
|
||||||
(
|
(
|
||||||
cd "${SRCDIR}"
|
cd "${SRCDIR}"
|
||||||
gzip -d < "${SRC}" | tar xf -
|
gzip -d < "${DISTFILES}/${SRC}" | tar xf -
|
||||||
)
|
)
|
||||||
echo "done"
|
echo "done"
|
||||||
fi
|
fi
|
||||||
@@ -119,6 +125,24 @@ package() {
|
|||||||
|
|
||||||
cd "${DESTDIR}"
|
cd "${DESTDIR}"
|
||||||
echo "i pkginfo" > "${HERE}/Prototype"
|
echo "i pkginfo" > "${HERE}/Prototype"
|
||||||
|
|
||||||
|
if [ ! -z "${PREINSTALL}" ]; then
|
||||||
|
cp "${PREINSTALL}" preinstall
|
||||||
|
echo "i preinstall" >> "${HERE}/Prototype"
|
||||||
|
]
|
||||||
|
|
||||||
|
if [ ! -z "${POSTINSTALL}" ]; then
|
||||||
|
cp "${POSTINSTALL}" postinstall
|
||||||
|
echo "i postinstall" >> "${HERE}/Prototype"
|
||||||
|
]
|
||||||
|
|
||||||
|
if [ ! -z "${CHECKINSTALL}" ]; then
|
||||||
|
cp "${CHECKINSTALL}" checkinstall
|
||||||
|
echo "i checkinstall" >> "${HERE}/Prototype"
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
find . | pkgproto | awk '{print $1 " " $2 " /" $3 " " $4 " root root"}' >> "${HERE}/Prototype"
|
find . | pkgproto | awk '{print $1 " " $2 " /" $3 " " $4 " root root"}' >> "${HERE}/Prototype"
|
||||||
cd "${HERE}"
|
cd "${HERE}"
|
||||||
|
|
||||||
@@ -131,8 +155,11 @@ package() {
|
|||||||
# cd "${HERE}"
|
# cd "${HERE}"
|
||||||
# compress -f ${PACKAGE}_${VERSION}_${ARCH}_${OS}.tar
|
# compress -f ${PACKAGE}_${VERSION}_${ARCH}_${OS}.tar
|
||||||
|
|
||||||
rm "${HERE}/Prototype"
|
rm -f "${HERE}/Prototype"
|
||||||
rm "${HERE}/pkginfo"
|
rm -f "${HERE}/pkginfo"
|
||||||
|
rm -f "${HERE}/preinstall"
|
||||||
|
rm -f "${HERE}/postinstall"
|
||||||
|
rm -f "${HERE}/checkinstall"
|
||||||
}
|
}
|
||||||
|
|
||||||
runonce() {
|
runonce() {
|
||||||
@@ -192,11 +219,14 @@ if [ "${OPT_FORCE}" = "1" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
mkdir -p "${SRCDIR}"
|
|
||||||
|
|
||||||
|
mkdir -p "${DISTFILES}"
|
||||||
runonce download
|
runonce download
|
||||||
|
|
||||||
|
mkdir -p "${SRCDIR}"
|
||||||
runonce extract
|
runonce extract
|
||||||
runonce patchsrc
|
runonce patchsrc
|
||||||
|
|
||||||
runonce configure
|
runonce configure
|
||||||
runonce build
|
runonce build
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user