First commit, full project

This commit is contained in:
Thorsten Spille 2022-06-11 17:16:32 +02:00
commit 01e8ace8ff
5 changed files with 105 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
src/*
build/*

82
builder Executable file
View 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

9
environment Normal file
View File

@ -0,0 +1,9 @@
package_name=Python3
configure_sript=configure
dl_prefix=https://www.python.org/ftp/python
dl_name=Python
dl_suffix=tgz
dpkg_depends="zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget"
configure_extra_params="--enable-optimizations"
make_test=1
install_param="install"

11
run Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
set -euo pipefail
PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
source environment
source version
for ver in ${versions[@]}; do
VERSION=$(wget -q -O - $dl_prefix/ | grep -o "$ver.[0-9]" | tail -1)
./builder $VERSION
done

1
version Normal file
View File

@ -0,0 +1 @@
versions=(3.8 3.9 3.10)