Kaydet (Commit) 3aad8781 authored tarafından sulincix's avatar sulincix

hooks

üst 9f901fd8
...@@ -4,4 +4,6 @@ confmake(){ ...@@ -4,4 +4,6 @@ confmake(){
./configure --prefix=/usr "$@" ./configure --prefix=/usr "$@"
make -j$(nproc) make -j$(nproc)
} }
conf(){
./configure --prefix=/usr "$@"
}
#!/bin/bash
remove(){
if [ -e "$1" ] ; then
warn "Removing $1"
rm -rf "$1"
fi
}
remove_additional(){
remove $INSTALLDIR/usr/share/man
remove $INSTALLDIR/usr/share/help
remove $INSTALLDIR/usr/share/locale
remove $INSTALLDIR/usr/share/doc
}
remove_devel(){
remove $INSTALLDIR/usr/include
}
#!/bin/bash
cmake_configure(){
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr "$@"
}
#!/bin/bash
fn_exists(){
LC_ALL=C type $1 | grep -q 'shell function' &>/dev/null
}
...@@ -12,10 +12,3 @@ unibuild-meson(){ ...@@ -12,10 +12,3 @@ unibuild-meson(){
"$@" "$@"
} }
automeson(){
mkdir build
meson build "$@"
cd build
ninja
cd ..
}
#!/bin/bash
name="bash"
version="5.0"
summary="Bash shell"
executable="bash"
description="The bash shell"
builddepends=("gcc")
depends=("readline")
license="gplv3"
release="1"
source=(https://ftp.gnu.org/gnu/bash/bash-5.0.tar.gz)
#BuildType="autotools"
#!/bin/bash
if [ "$(ls -F $WORKDIR | grep \/$ | wc -l)" == "1" ] ; then
export WORKDIR="$WORKDIR/$(ls -F $WORKDIR | grep \/$)"
fi
info "Single source detected: new workdir => $WORKDIR"
if fn_exists "_setup" && fn_exists "_build" && fn_exists "_install" ; then
msg ">>Function checking done"
else
if [ "$BuildType" != "" ] ; then
info "Build Type found."
elif [ -f "$WORKDIR/meson.build" ] ; then
BuildType="meson"
elif [ -f "$WORKDIR/CMakeLists.txt" ] ; then
BuildType="cmake"
elif [ -f "$WORKDIR/setup.py" ] ; then
BuildType="python"
elif [ -f "$WORKDIR/configure" ] ; then
BuildType="autotools"
fi
fi
#!/bin/bash
if [ "$BuildType" == "autotools" ] ; then
_setup(){
if [ -f "./autogen.sh" ] ; then
NOCONFIGURE=1 ./autogen.sh
fi
conf $CONFIG_OPTIONS
}
_build(){
make -j$(nproc)
}
_install(){
make install DESTDIR=$INSTALLDIR
}
fi
#!/bin/bash
if [ "$BuildType" == "cmake" ] ; then
_setup(){
cmake_configure $CONFIG_OPTIONS
}
_build(){
make -j$(nproc)
}
_install(){
make install DESTDIR=$INSTALLDIR
}
fi
#!/bin/bash
if [ "$BuildType" == "meson" ] ; then
_setup(){
unibuild-meson build $CONFIG_OPTIONS
}
_build(){
ninja -c build
}
_install(){
DESTDIR="$INSTALLDIR" meson install -C build
}
fi
#!/bin/bash
if [ "$BuildType" == "python" ] ; then
_setup(){
info "Setup not needed"
}
_build(){
python3 setup.py build
}
_install(){
python3 setup.py install --root="$INSTALLDIR" --optimize=1 --skip-build
}
fi
install:
bash install.sh
...@@ -3,6 +3,7 @@ export CURDIR=$(pwd) ...@@ -3,6 +3,7 @@ export CURDIR=$(pwd)
export BUILDDIR=$(mktemp -d) export BUILDDIR=$(mktemp -d)
export WORKDIR=$BUILDDIR/work export WORKDIR=$BUILDDIR/work
export INSTALLDIR=$BUILDDIR/install export INSTALLDIR=$BUILDDIR/install
export DESTDIR=$INSTALLDIR
export PKGDIR=$BUILDDIR/package export PKGDIR=$BUILDDIR/package
mkdir -p $WORKDIR $PKGDIR $INSTALLDIR mkdir -p $WORKDIR $PKGDIR $INSTALLDIR
info "Build Directory=$BUILDDIR" info "Build Directory=$BUILDDIR"
...@@ -5,4 +5,3 @@ export CFLAGS="-O3 -s" ...@@ -5,4 +5,3 @@ export CFLAGS="-O3 -s"
export CXXFLAGS="-O3 -s" export CXXFLAGS="-O3 -s"
export LANG=C export LANG=C
export LC_ALL=C export LC_ALL=C
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
__write_remove(){ __write_remove(){
cd $INSTALLDIR cd $INSTALLDIR
find | while read line find | sort | while read line
do do
if [ -f $line ] ; then if [ -f $line ] ; then
echo "rm -f $line" | sed "s/\.\//\//g" echo "rm -f $line" | sed "s/\.\//\//g"
fi fi
done done
find | while read line find | sort -r | while read line
do do
if [ -d $line ] && [ $line != "." ] ; then if [ -d $line ] && [ $line != "." ] ; then
echo "rmdir $line 2>/dev/null" | sed "s/\.\//\//g" echo "rmdir $line 2>/dev/null" | sed "s/\.\//\//g"
......
...@@ -17,11 +17,16 @@ else ...@@ -17,11 +17,16 @@ else
fi fi
source $MODDIR/../target/$TARGET source $MODDIR/../target/$TARGET
source $MODDIR/../host/$HOST source $MODDIR/../host/$HOST
msg ">>> Checking dependencies" msg ">>> Checking dependencies"
_get_build_deps _get_build_deps
cd $BUILDDIR cd $BUILDDIR
msg ">>> Getting sources" msg ">>> Getting sources"
_fetch _fetch
msg ">>> Running hooks"
for hook in $(ls $MODDIR/../hooks | sort) ; do
source $MODDIR/../hooks/$hook
done
cd $WORKDIR cd $WORKDIR
msg ">>> Running setup function" msg ">>> Running setup function"
_setup _setup
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment