First commit, full project
This commit is contained in:
82
builder
Executable file
82
builder
Executable file
@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
|
||||
|
||||
prog='$(basename "$0")'
|
||||
|
||||
source environment
|
||||
|
||||
version=$1
|
||||
package=python3
|
||||
package_name=package
|
||||
|
||||
echo "$(date) setting global vars..."
|
||||
libc6_version=$( dpkg -s libc6 | grep Version | cut -d':' -f2 | cut -d' ' -f2 | cut -d'-' -f1)
|
||||
dpkg_arch=$(dpkg --print-architecture)
|
||||
deb_package=${package}_${version}_${dpkg_arch}
|
||||
src_dir=$PWD/src
|
||||
build_dir=$PWD/build
|
||||
prefix=usr
|
||||
my_dir=$PWD
|
||||
|
||||
echo "$(date) installing dependencies..."
|
||||
sudo DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq install build-essential dpkg-dev $dpkg_depends
|
||||
sudo ldconfig
|
||||
|
||||
echo "$(date) seting download url"
|
||||
download=$dl_prefix/$version/$dl_name-$version.$dl_suffix
|
||||
echo "download_url=$download"
|
||||
|
||||
echo "$(date) creating build directories..."
|
||||
mkdir -p $src_dir
|
||||
mkdir -p $build_dir
|
||||
mkdir -p $build_dir/$deb_package/DEBIAN
|
||||
|
||||
echo "$(date) downloading and extracting source code..."
|
||||
cd $src_dir
|
||||
wget $download
|
||||
tar -xvf $dl_name-$version.$dl_suffix
|
||||
rm $dl_name-$version.$dl_suffix
|
||||
cd $dl_name-$version
|
||||
|
||||
echo "$(date) configuring project..."
|
||||
./$configure_sript --prefix=/$prefix $configure_extra_params
|
||||
|
||||
echo "$(date) compiling project..."
|
||||
make -j$(nproc)
|
||||
|
||||
echo "$(date) testing build if activated..."
|
||||
if [ $make_test -gt 0 ]; then
|
||||
make test
|
||||
fi
|
||||
|
||||
echo "$(date) installing build to target directory..."
|
||||
make DESTDIR=$build_dir/$deb_package $install_param
|
||||
|
||||
cd $my_dir
|
||||
|
||||
$build_dir/$deb_package/$prefix/bin/python3 -m pip install --prefix /$prefix --root $build_dir/$deb_package --upgrade pip
|
||||
$build_dir/$deb_package/$prefix/bin/python3 -m pip install --prefix /$prefix --root $build_dir/$deb_package six toml
|
||||
|
||||
cd $build_dir
|
||||
|
||||
echo "$(date) creating DEBIBAN/control..."
|
||||
cat << EOF > $deb_package/DEBIAN/control
|
||||
Package: $package_name
|
||||
Version: $version
|
||||
Architecture: $dpkg_arch
|
||||
Essential: no
|
||||
Priority: optional
|
||||
Depends: libc6 (>= $libc6_version)
|
||||
Maintainer: bashclub
|
||||
Description: The deb package for $package_name $version maintained from bashclub.org.
|
||||
EOF
|
||||
|
||||
echo "$(date) building deb package..."
|
||||
dpkg-deb --build $deb_package
|
||||
rm -r $src_dir/$dl_name-$version
|
||||
rm -r $build_dir/$deb_package
|
||||
|
||||
echo "Build succeeded! You can find the .deb package at: $build_dir/$deb_package.deb"
|
||||
exit 0
|
Reference in New Issue
Block a user