pax_global_header 0000666 0000000 0000000 00000000064 13726714240 0014520 g ustar 00root root 0000000 0000000 52 comment=e4349cbf5615ea54a238e94ae742c4496f3ab409
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/ 0000775 0000000 0000000 00000000000 13726714240 0020266 5 ustar 00root root 0000000 0000000 unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/LICENSE 0000664 0000000 0000000 00000002456 13726714240 0021302 0 ustar 00root root 0000000 0000000 BSD 2-Clause License
Copyright (c) 2020, sulinos / Sulin Devel
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/doc/ 0000775 0000000 0000000 00000000000 13726714240 0021033 5 ustar 00root root 0000000 0000000 unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/doc/building.rst 0000664 0000000 0000000 00000011623 13726714240 0023365 0 ustar 00root root 0000000 0000000 Building with unibuild
======================
**Unibuild** need a build spec. Build spec must be bash script. *name* *version* *release* *summary* *description* variables and *_setup* *_build* *_install* functions uses. For example:
.. code-block:: shell
#!/bin/bash
name="bash"
version="5.0"
summary="bash shell"
description="The bash shell"
source=(https://ftp.gnu.org/gnu/bash/bash-5.0.tar.gz)
_setup(){
./configure --prefix=/usr
}
_build(){
make
}
_install(){
make install DESTDIR=$INSTALLDIR
}
BUILDDIR
^^^^^^^^
Main directory that uses for all operations. Unibuild create 3 directory for building. **WORKDIR** **INSTALLDIR** **PKGDIR**
All directories in builddir. Unibuild created builddir with **mktemp -d** command.
**1. WORKDIR**
Workdir is building directory. Before running functions, unibuild go workdir. Workdir is changeable variable. If only one source directory in workdir. unibuild automaticaly change workdir as source directory.
**2. INSTALLDIR**
Installdir is package destdir. Spec must store package files in here.
**3. PKGDIR**
Pkgdir is packaging directory required by target packager.
Build functions
^^^^^^^^^^^^^^^
If you dont define functions, unibuild try to detect build method and create automaticaly. Or you can define **BuildType** variable for creating build function as automaticaly. Also you can define **CONFIG_OPTIONS** variable for auto build options. For example:
.. code-block:: shell
#!/bin/bash
name="bash"
version="5.0"
summary="Bash shell"
description="The bash shell"
builddepends=("gcc")
depends=("readline")
license="gplv3"
source=(https://ftp.gnu.org/gnu/bash/bash-5.0.tar.gz)
BuildType="autotools"
This example uses autotools for compiling. autotools define build functions look like this:
.. code-block:: shell
_setup(){
./configure --prefix=/usr $CONFIG_OPTIONS
}
_build(){
make -j$(nproc)
}
_install(){
make install DESTDIR=$INSTALLDIR
}
The gnu bash source code has ./configure script so if you dont define build functions, unibuild detect and set **BuildType** variable.
Function calling order: _setup => _build => _install
Build target and host
^^^^^^^^^^^^^^^^^^^^^
Unibuild is universali builder so supported most of distribution. You can define **TARGET** and **HOST** variables.
======== =================================================
VARIABLE DESCRIPION
======== =================================================
TARGET Package build target: debian, inary, appimage ...
HOST Builder distribution: debian, inary ...
======== =================================================
host and target automaticaly detected if you dont define.
Spec variables
^^^^^^^^^^^^^^
Unibuild spec variables and description avaiable here:
======== ============ ======================================================== =======
OPTIONAL VARIABLE DESCRIPION Type
======== ============ ======================================================== =======
no name Package name. String
no version Package version. Only can use [0-9] or . or - String
**yes** release Package release. Used by inary. Integer
no source Package source code url or path. Array
**yes** executable Package main executable name. Used by appimage String
no description Package description. String
no summary Package summary. String
**yes** builddepends Package names that required by compiling. Array
**yes** depends Package runtime dependencies. Array
no license Source code license. String
**yes** partof Package section or component name. String
**yes** categories Appilcation categories. Used by appimage String
**yes** icon Application icon name or path. Used by appimage String
**yes** arch Package architecture. if dont define, auto detected. String
**yes** maintainer Package maintainer name. String
**yes** email Packager email. String
**yes** isa Package type. Used by inary. Array
======== ============ ======================================================== =======
Unibuild supported different source types. All known source types:
1. name::git://xxxx.git::branch
2. git+https://xxxxx.git::branch
3. name::https://xxxxx
4. /path/to/name/xxx
5. https://xxxxxx
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/doc/development/ 0000775 0000000 0000000 00000000000 13726714240 0023355 5 ustar 00root root 0000000 0000000 unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/doc/development/general.rst 0000664 0000000 0000000 00000002521 13726714240 0025524 0 ustar 00root root 0000000 0000000 MODDIR
=====
Include order : *api -> modules -> unibuild file -> host -> target -> hooks* All imports are alphabeticaly.
Moddir contains unibuild **modules**, **api**, **hooks**, **target** and **host** directories.
Modules
^^^^^
Unibuild modules in here. modules included and called before unibuild files. Defining main functins and detecting target and host functions in here. Also default fallback variables defined here. Unibuild require **_fetch** function for getting sources. Other functions are optional.
Api
^^^
Unibuild helper function defined here. Included before unibuild files. All functions are optional. Modules can use api functions.
You can define **minver** value for required minimum unibuild api version and you can define **maxver** value for required maximum unibuild api version. Default value is current version.
Hooks
^^^^
Hook functions included after unibuild files so override unibuild files. you don't have to define unibuild function or variable in here. All hook functions are optional.
Target
^^^^
Target functions are package manager specific functions. More detail : doc/development/target.rst
Host
^^^^
Host functions are distribution specific functions. More detail : doc/development/host.rst
unibuildrc file
========
Firstly imported file. **$HOME/.unibuildrc**
All unibuild functions override unibuildrc file.
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/doc/development/host.rst 0000664 0000000 0000000 00000001065 13726714240 0025066 0 ustar 00root root 0000000 0000000 Create new host
=================
Host file must be within **host/** directory. For auto detecting host, you should edit **modules/autohost** file.
Only **_get_build_deps** function needed. We must use **builddepends** array con check and install build dependencies.
for example:
.. code-block:: shell
_get_build_deps(){
needed="" #missing package list
for i in ${builddepends[@]}
do
[ -f /info/$i ] || needed="$needed $i"
done
if [ "$needed" != "" ] ; then
err "Missing: $needed"
.... # package installation command or exit
fi
}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/doc/development/target.rst 0000664 0000000 0000000 00000002363 13726714240 0025401 0 ustar 00root root 0000000 0000000 Create new target
=================
Target functions must be within **target/** directory in source code.
For adding automaticaly detecting target you should edit **modules/autotarget** file.
Target functions override unibuild files functions so you don't have to define unibuild function or variable in target file.
We need two functions. **_create_metadata** and **_package**. You can create helper functions.
Target functions run in **$PKGDIR**.
__create_metadata
^^^^^^^^^^^^^^^^^
This function generate package info file. You should write package information and files list.
for example:
.. code-block:: shell
_create_metadata(){
mkdir $PKGDIR/info/
echo "Name: $name" >> $PKGDIR/info/$name
echo "Version: $version" >> $PKGDIR/info/$name
echo "Summary: $summary" >> $PKGDIR/info/$name
echo "Description: $description" >> $PKGDIR/info/$name
cd $INSTALLDIR
find >> $PKGDIR/info/$name.files
}
_package
^^^^^^^^
This function create binary package file. You should compress or archive build files.
Installed files avaiable in **$INSTALLDIR**. You can copy all files in **$INSTALLDIR** to **$PKGDIR**.
for example:
.. code-block:: shell
_package(){
cp -prfv $INSTALLDIR/* $PKGDIR/
cd $PKGDIR
tar -cf $CURDIR/$name-$version.tar *
}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/example/ 0000775 0000000 0000000 00000000000 13726714240 0021721 5 ustar 00root root 0000000 0000000 unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/example/example 0000664 0000000 0000000 00000000770 13726714240 0023303 0 ustar 00root root 0000000 0000000 #!/bin/bash
name="unibuild"
version="1.0"
summary="Universal builder"
executable="unibuild"
description="The universal build system for posix"
builddepends=("bash")
depends=("curl" "wget" "bash")
license="gplv3"
release="1"
source=(git+https://gitlab.com/sulinos/devel/unibuild)
_setup(){
# Unibuild has single source mode. so do not do this action
# export WORKDIR=$WORKDIR/unibuild
echo "Setup not needed"
}
_build(){
chmod +x ./install.sh
}
_install(){
DESTDIR=$INSTALLDIR ./install.sh
}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/example/example_git 0000664 0000000 0000000 00000000532 13726714240 0024142 0 ustar 00root root 0000000 0000000 #!/bin/bash
name="inary"
version="1.4"
summary="Inary package manager"
executable="inary"
description="Package manager for sulinos"
builddepends=("python3")
depends=("python3" "curl")
license="gplv3"
release="1"
source=(git+https://gitlab.com/sulinos/devel/inary::develop)
_build(){
make build
}
_install(){
make install DESTDIR=$INSTALLDIR
}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/example/example_no_functions 0000664 0000000 0000000 00000000375 13726714240 0026070 0 ustar 00root root 0000000 0000000 #!/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"
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/install.sh 0000664 0000000 0000000 00000000357 13726714240 0022275 0 ustar 00root root 0000000 0000000 #!/bin/bash
mkdir -p $DESTDIR/usr/lib/unibuild || true
mkdir -p $DESTDIR/usr/bin || true
cp -prfv src/* $DESTDIR/usr/lib/unibuild
chmod +x -R $DESTDIR/usr/lib/unibuild/*
mv $DESTDIR/usr/lib/unibuild/unibuild.sh $DESTDIR/usr/bin/unibuild
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/makefile 0000664 0000000 0000000 00000000032 13726714240 0021761 0 ustar 00root root 0000000 0000000 install:
bash install.sh
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/netinst.sh 0000664 0000000 0000000 00000000304 13726714240 0022303 0 ustar 00root root 0000000 0000000 tmpdir=$(mktemp -d)
cd $tmpdir
wget https://gitlab.com/sulinos/devel/unibuild/-/archive/master/unibuild-master.tar.gz -O unibuild.tar.gz
tar -xf unibuild.tar.gz
cd unibuild-master
bash install.sh
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/readme.rst 0000664 0000000 0000000 00000000674 13726714240 0022264 0 ustar 00root root 0000000 0000000 unibuild
========
The universal **build** script system.
Easy install
============
.. code-block:: shell
curl -s https://gitlab.com/sulinos/devel/unibuild/-/raw/master/netinst.sh | bash -s --
for install
===========
DESTDIR=*your_DESTDIR* bash install.sh
Simple usage
============
[TARGET=*your_target*] **unibuild** [*file/url*]
Documentation
=============
Visit https://gitlab.com/sulinos/devel/unibuild/-/blob/master/doc/building.rst
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/ 0000775 0000000 0000000 00000000000 13726714240 0021055 5 ustar 00root root 0000000 0000000 unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/api/ 0000775 0000000 0000000 00000000000 13726714240 0021626 5 ustar 00root root 0000000 0000000 unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/api/00-loggers 0000664 0000000 0000000 00000000302 13726714240 0023423 0 ustar 00root root 0000000 0000000 #!/bin/bash
msg(){
echo -e "\033[32;1m$*\033[;0m"
}
warn(){
echo -e "\033[33;1m$*\033[;0m"
}
err(){
echo -e "\033[31;1m$*\033[;0m" > /dev/stderr
}
info(){
echo -e "\033[34;1m$*\033[;0m"
}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/api/apiversion 0000664 0000000 0000000 00000000114 13726714240 0023724 0 ustar 00root root 0000000 0000000 export minver=${unibuild_api_version}
export maxver=${unibuild_api_version}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/api/autotools 0000664 0000000 0000000 00000000212 13726714240 0023575 0 ustar 00root root 0000000 0000000 #!/bin/bash
export NOCONFIGURE=1
confmake(){
./configure --prefix=/usr "$@"
make -j$(nproc)
}
conf(){
./configure --prefix=/usr "$@"
}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/api/clean 0000664 0000000 0000000 00000000453 13726714240 0022635 0 ustar 00root root 0000000 0000000 #!/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
}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/api/cmaketools 0000664 0000000 0000000 00000000143 13726714240 0023710 0 ustar 00root root 0000000 0000000 #!/bin/bash
cmake_configure(){
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr "$@"
}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/api/functions 0000664 0000000 0000000 00000000331 13726714240 0023556 0 ustar 00root root 0000000 0000000 #!/bin/bash
fn_exists(){
LC_ALL=C type $1 2>/dev/null | grep -q 'function' &>/dev/null
}
is_target(){
return [ "$TARGET" == "$1" ]
}
is_host(){
return [ "$HOST" == "$1" ]
}
notnull(){
return [ "$1" == "" ]
}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/api/github 0000664 0000000 0000000 00000000343 13726714240 0023033 0 ustar 00root root 0000000 0000000 #!/bin/bash
github(){
user=$1
project=$2
version=$(curl https://github.com/$user/$project/releases | grep "/.*..tar.gz" | sed "s/.*href=\"//g" | sed "s/\".*//g" | grep "^/" | head -n 1)
echo https://github.com$version
}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/api/mesontools 0000664 0000000 0000000 00000000434 13726714240 0023754 0 ustar 00root root 0000000 0000000 #!/bin/bash
unibuild-meson(){
meson setup \
--prefix /usr \
--libexecdir lib \
--sbindir bin \
--buildtype plain \
--auto-features enabled \
--wrap-mode nodownload \
-D b_lto=true \
-D b_pie=true \
"$@"
}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/hooks/ 0000775 0000000 0000000 00000000000 13726714240 0022200 5 ustar 00root root 0000000 0000000 unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/hooks/00-single-source 0000664 0000000 0000000 00000000272 13726714240 0025120 0 ustar 00root root 0000000 0000000 #!/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"
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/hooks/01-auto-buildtype 0000664 0000000 0000000 00000000672 13726714240 0025315 0 ustar 00root root 0000000 0000000 #!/bin/bash
if fn_exists "_setup" || fn_exists "_build" || fn_exists "_install" ; then
info "Auto build type detection disabled."
elif [ "$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
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/hooks/01-relations 0000664 0000000 0000000 00000000523 13726714240 0024341 0 ustar 00root root 0000000 0000000 #!/bin/bash
info "Unibuild api version = ${unibuild_api_version}"
if [ ${unibuild_api_version} -lt ${minver} ] ; then
warn "Required minimum version = ${minver}"
err "Please update unibuild."
exit 1
fi
if [ ${unibuild_api_version} -gt ${maxver} ] ; then
warn "Required maximum version = ${maxver}"
err "Building aborted."
exit 1
fi
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/hooks/autotools 0000664 0000000 0000000 00000000375 13726714240 0024161 0 ustar 00root root 0000000 0000000 #!/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
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/hooks/cmaketools 0000664 0000000 0000000 00000000277 13726714240 0024272 0 ustar 00root root 0000000 0000000 #!/bin/bash
if [ "$BuildType" == "cmake" ] ; then
_setup(){
cmake_configure ${CONFIG_OPTIONS[@]}
}
_build(){
make -j$(nproc)
}
_install(){
make install DESTDIR=$INSTALLDIR
}
fi
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/hooks/mesontools 0000664 0000000 0000000 00000000317 13726714240 0024326 0 ustar 00root root 0000000 0000000 #!/bin/bash
if [ "$BuildType" == "meson" ] ; then
_setup(){
unibuild-meson build ${CONFIG_OPTIONS[@]}
}
_build(){
ninja -C build
}
_install(){
DESTDIR="$INSTALLDIR" meson install -C build
}
fi
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/hooks/pythontools 0000664 0000000 0000000 00000000341 13726714240 0024523 0 ustar 00root root 0000000 0000000 #!/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
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/host/ 0000775 0000000 0000000 00000000000 13726714240 0022032 5 ustar 00root root 0000000 0000000 unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/host/arch 0000775 0000000 0000000 00000000403 13726714240 0022672 0 ustar 00root root 0000000 0000000 #!/bin/bash
_get_build_deps(){
needed=""
for i in ${builddepends[@]}
do
pacman -Qs $i > /dev/null || needed="$needed $i"
done
if [ "$needed" != "" ] ; then
err "Missing: $needed"
su -c "pacman -S $needed" || exit 1
fi
} unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/host/debian 0000664 0000000 0000000 00000000426 13726714240 0023201 0 ustar 00root root 0000000 0000000 #!/bin/bash
_get_build_deps(){
needed=""
for i in ${builddepends[@]}
do
cat /var/lib/dpkg/status | grep "^Package: $i$" &>/dev/null || needed="$needed $i"
done
if [ "$needed" != "" ] ; then
err "Missing: $needed"
su -c "apt-get install $needed" || exit 1
fi
}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/host/default 0000664 0000000 0000000 00000000310 13726714240 0023373 0 ustar 00root root 0000000 0000000 #!/bin/bash
_get_build_deps(){
needed=""
for i in ${builddepends[@]}
do
[ -f /info/$i ] || needed="$needed $i"
done
if [ "$needed" != "" ] ; then
err "Missing: $needed"
exit 1
fi
}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/host/inary 0000664 0000000 0000000 00000000415 13726714240 0023077 0 ustar 00root root 0000000 0000000 #!/bin/bash
_get_build_deps(){
needed=""
for i in ${builddepends[@]}
do
ls /var/lib/inary/package/ | grep "^$i-[1-9]" &>/dev/null || needed="$needed $i"
done
if [ "$needed" != "" ] ; then
err "Missing: $needed"
su -c "inary it $needed" || exit 1
fi
}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/modules/ 0000775 0000000 0000000 00000000000 13726714240 0022525 5 ustar 00root root 0000000 0000000 unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/modules/autodistro 0000664 0000000 0000000 00000000772 13726714240 0024653 0 ustar 00root root 0000000 0000000 #!/bin/bash
if [ -f "/etc/lsb-release" ] ; then
export DISTRO=$(cat /etc/lsb-release | grep "^DISTRIB_ID=" | head -n 1 | sed "s/.*=//g")
elif [ -f "/etc/os-release" ] ; then
export DISTRO=$(cat /etc/os-release | grep "^NAME=" | head -n 1 | sed "s/.*=//g")
elif [ -d /var/lib/dpkg/ ] ; then
export DISTRO="Debian"
elif [ -d /var/lib/inary ] ; then
export DISTRO="Sulin"
elif [ -d /var/lib/pacman ] ; then
export DISTRO="Arch"
else
export DISTRO="Unknown"
fi
info "Distro=$DISTRO"
info "Type=$(uname)"
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/modules/autohost 0000664 0000000 0000000 00000000400 13726714240 0024310 0 ustar 00root root 0000000 0000000 #!/bin/bash
if [ "$HOST" == "" ] ; then
if [ -d /var/lib/dpkg ] ; then
export HOST=debian
elif [ -d /var/lib/inary ] ; then
export HOST=inary
elif [ -d /var/lib/pacman ] ; then
export HOST=arch
else
export HOST=default
fi
fi
info "Host=$HOST"
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/modules/autotarget 0000664 0000000 0000000 00000001411 13726714240 0024624 0 ustar 00root root 0000000 0000000 #!/bin/bash
if [ "$TARGET" == "" ] ; then
if [ -d /var/lib/dpkg ] ; then
export TARGET=debian
elif [ -d /var/lib/inary ] ; then
export TARGET=inary
elif [ -d /var/lib/pacman ] ; then
export TARGET=arch
else
export TARGET=default
fi
fi
set +e
if [ "$TARGET" == "debian" ] ; then
if [ "$arch" == "" ] ; then
[ "$(uname -m)" == "x86_64" ] && arch="amd64" || true
[ "$(uname -m)" == "i686" ] && arch="i386" || true
[ "$(uname -m)" == "aarch64" ] && arch="arm64" || true
[ "$(uname -m)" == "armhf" ] && arch="arm" || true
fi
elif [ "$TARGET" == "inary" ] ; then
if [ "$arch" == "" ] ; then
arch="$(uname -m)"
fi
elif [ "$TARGET" == "arch" ] ; then
if [ "$arch" == "" ] ; then
arch="$(uname -m)"
fi
fi
set -e
info "Target=$TARGET"
info "Arch=$arch"
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/modules/directories 0000664 0000000 0000000 00000000434 13726714240 0024765 0 ustar 00root root 0000000 0000000 #!/bin/bash
export CURDIR=$(pwd)
[ "$BUILDDIR" == "" ] && export BUILDDIR=$(mktemp -d)
export WORKDIR=$BUILDDIR/work
export INSTALLDIR=$BUILDDIR/install
export DESTDIR=$INSTALLDIR
export PKGDIR=$BUILDDIR/package
mkdir -p $WORKDIR $PKGDIR $INSTALLDIR
info "Build Directory=$BUILDDIR"
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/modules/fetcher 0000664 0000000 0000000 00000002672 13726714240 0024077 0 ustar 00root root 0000000 0000000 #!/bin/bash
_fetch(){
cd $WORKDIR
for src in ${source[@]} ; do
if [ -f $CURDIR/$src ] ; then
info "Copying: $src"
cp -prfv $CURDIR/$src $WORKDIR/
elif [ -d $CURDIR/$src ] ; then
info "Copying: $src"
cp -prfv $CURDIR/$src $WORKDIR/
elif echo "$src" | grep "git://" &>/dev/null ; then
srcloc=$(echo $src | sed "s|^.*git://|git://|g" | sed "s/::.*//g")
srcname=$(echo $src | sed "s|::git://.*$||g")
branch=$(echo $src | sed "s|^.*::||g")
echo $srcloc $srcname $branch
info "Clonning: $srcloc"
if [ "$branch" == "" ] ; then
[ -d "$srcname" ] || git clone $srcloc $srcname
else
[ -d "$srcname" ] || git clone $srcloc $srcname -b $branch
fi
elif echo "$src" | grep "^git+" &>/dev/null ; then
srcloc=$(echo $src | sed "s|^git+||g" | sed "s/::.*//g")
echo $src | grep "::" &>/dev/null && branch=$(echo $src | sed "s|^.*::||g")
echo $srcloc $srcname $branch
info "Clonning: $srcloc"
if [ "$branch" == "" ] ; then
git clone $srcloc || true
else
git clone $srcloc -b $branch || true
fi
elif echo "$src" | grep "::http" &>/dev/null ; then
srcloc=$(echo $src | sed "s|^.*::||g")
srcname=$(echo $src | sed "s|::http.*$||g")
echo $srcloc
info "Downloading: $srcloc"
wget -c $srcloc -O $srcname
echo $srcname | grep ".tar.*" && tar -xf $srcname
else
info "Downloading: $srcloc"
wget -c $src -O $(basename $src) || true
basename $src | grep ".tar.*" && tar -xf $(basename $src) || true
fi
done
cd $CURDIR
}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/modules/fuckwsl 0000664 0000000 0000000 00000000222 13726714240 0024122 0 ustar 00root root 0000000 0000000 #!/bin/bash
wsl_block(){
var=$(uname -r)
if [[ "$var" == *Microsoft* || "$var" == "*WSL*" ]]
then
exit 1
fi
}
wsl_block
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/modules/packages 0000664 0000000 0000000 00000000700 13726714240 0024223 0 ustar 00root root 0000000 0000000 #!/bin/bash
export name="unnamed"
export version="1.0"
export release="1"
export homepage="https://example.github.io"
export url="https://gitlab.com/example"
export priority="unknown"
export date="01.01.1970"
if [ -z $maintainer ]; then
export maintainer="packager"
fi
if [ -z $email ]; then
export email="packager@package.org"
fi
export summary="summary missing"
export description="description missing"
export size="31"
export license="gplv3"
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/modules/variables 0000664 0000000 0000000 00000000167 13726714240 0024424 0 ustar 00root root 0000000 0000000 #!/bin/bash
export CC=gcc
export CXX=g++
export CFLAGS="-O3 -s"
export CXXFLAGS="-O3 -s"
export LANG=C
export LC_ALL=C
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/target/ 0000775 0000000 0000000 00000000000 13726714240 0022343 5 ustar 00root root 0000000 0000000 unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/target/appimage 0000664 0000000 0000000 00000005175 13726714240 0024061 0 ustar 00root root 0000000 0000000 #!/bin/bash
_write_AppRun(){
echo "#!/bin/sh"
echo 'SELF=$(readlink -f "$0")'
echo 'HERE=${SELF%/*}'
echo 'export PATH="${HERE}/usr/bin/:${HERE}/usr/sbin/:${HERE}/usr/games/:${HERE}/bin/:${HERE}/sbin/${PATH:+:$PATH}"'
echo 'export LD_LIBRARY_PATH="${HERE}/usr/lib/:${HERE}/usr/lib/i386-linux-gnu/:${HERE}/usr/lib/x86_64-linux-gnu/:${HERE}/usr/lib32/:${HERE}/usr/lib64/:${HERE}/lib/:${HERE}/lib/i386-linux-gnu/:${HERE}/lib/x86_64-linux-gnu/:${HERE}/lib32/:${HERE}/lib64/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"'
echo 'export PYTHONPATH="${HERE}/usr/share/pyshared/${PYTHONPATH:+:$PYTHONPATH}"'
echo 'export XDG_DATA_DIRS="${HERE}/usr/share/${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"'
echo 'export PERLLIB="${HERE}/usr/share/perl5/:${HERE}/usr/lib/perl5/${PERLLIB:+:$PERLLIB}"'
echo 'export GSETTINGS_SCHEMA_DIR="${HERE}/usr/share/glib-2.0/schemas/${GSETTINGS_SCHEMA_DIR:+:$GSETTINGS_SCHEMA_DIR}"'
echo 'export QT_PLUGIN_PATH="${HERE}/usr/lib/qt4/plugins/:${HERE}/usr/lib/i386-linux-gnu/qt4/plugins/:${HERE}/usr/lib/x86_64-linux-gnu/qt4/plugins/:${HERE}/usr/lib32/qt4/plugins/:${HERE}/usr/lib64/qt4/plugins/:${HERE}/usr/lib/qt5/plugins/:${HERE}/usr/lib/i386-linux-gnu/qt5/plugins/:${HERE}/usr/lib/x86_64-linux-gnu/qt5/plugins/:${HERE}/usr/lib32/qt5/plugins/:${HERE}/usr/lib64/qt5/plugins/${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}"'
echo 'EXEC=$(grep -e "^Exec=.*" "${HERE}"/*.desktop | head -n 1 | cut -d "=" -f 2 | cut -d " " -f 1)'
echo 'exec "${EXEC}" "$@"'
}
_write_desktop(){
echo "[Desktop Entry]"
echo "Type=Application"
echo "Name=$name"
[ "$executable" == "" ] && export executable=$name
echo "Exec=$executable"
echo "Comment=$summary"
[ "$icon" == "" ] && export icon=$name
echo "Icon=$name"
if [ "$categories" == "" ] ; then
echo "Categories=$categories"
fi
echo "Terminal=false"
}
copy_library(){
while read stuff
do
ldd $stuff | grep "=>" | awk '{print $3}' | while read line
do
if [ -f $line ] ; then
mkdir -p $PKGDIR/$line || true
rmdir $PKGDIR/$line || true
cat $line > $PKGDIR/$line || true
cat $(readlink -f $line) > $PKGDIR/$(readlink -f $line)
chmod +x $PKGDIR/$line
fi
done
done
}
_create_metadata(){
cd $PKGDIR
_write_AppRun > $PKGDIR/AppRun
chmod +x $PKGDIR/AppRun
_write_desktop > $PKGDIR/$name.desktop
touch $PKGDIR/$name.png
}
_package(){
# checking appimagekit
if [ ! -f ~/.appimagekit ] ; then
wget -c https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-$(uname -m).AppImage -O ~/.appimagekit
chmod +x ~/.appimagekit
fi
cp -prfv $INSTALLDIR/* $PKGDIR/
[ "${PORTABLE}" == "true" ] && find $INSTALLDIR | copy_library &> /dev/null || true
cd $CURDIR
ARCH=$(uname -m) ~/.appimagekit $PKGDIR
}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/target/arch 0000775 0000000 0000000 00000005205 13726714240 0023210 0 ustar 00root root 0000000 0000000 #!/bin/bash
SOURCE_DATE_EPOCH=$(date +'%s')
if ! type -p gettext >/dev/null; then
gettext() {
printf "%s\n" "$@"
}
fi
write_kv_pair() {
local key="$1"
shift
for val in "$@"; do
if [[ $val = *$'\n'* ]]; then
error "$(gettext "Invalid value for %s: %s")" "$key" "$val"
exit $E_PKGBUILD_ERROR
fi
printf "%s = %s\n" "$key" "$val"
done
}
list_package_files() {
(
export LC_COLLATE=C
shopt -s dotglob globstar
# bash 5.0 only works with combo directory + file globs
printf '%s\0' **/*
)
}
__write_pkginfo() {
#Create .PKGINFO
echo -e "# Generated by unibuild"
echo -e "# using $(fakeroot -v)"
echo -e "pkgname = $name"
echo -e "pkgbase = $name"
echo -e "pkgver = $version-$release"
echo -e "pkgdesc = $description"
echo -e "url = $url"
echo -e "builddate = $SOURCE_DATE_EPOCH"
echo -e "packager = $maintainer"
echo -e "size = $(du -sb $INSTALLDIR | cut -f1)"
echo -e "arch = $arch"
echo -e "license = $license"
write_kv_pair "replaces" "${replaces[@]}"
write_kv_pair "group" "${groups[@]}"
write_kv_pair "conflict" "${conflicts[@]}"
write_kv_pair "provides" "${provides[@]}"
write_kv_pair "backup" "${backup[@]}"
write_kv_pair "depend" "${depends[@]}"
write_kv_pair "optdepend" "${optdepends[@]//+([[:space:]])/ }"
write_kv_pair "makedepend" "${builddepends[@]}"
write_kv_pair "checkdepend" "${checkdepends[@]}"
}
__write_buildinfo() {
#Create .BUILDINFO
echo -e "format = 2" >> $PKGDIR/.BUILDINFO
echo -e "pkgname = $name" >> $PKGDIR/.BUILDINFO
echo -e "pkgbase = $name" >> $PKGDIR/.BUILDINFO
echo -e "pkgver = $version-$release" >> $PKGDIR/.BUILDINFO
echo -e "pkgarch = $arch" >> $PKGDIR/.BUILDINFO
local sum="$(sha256sum "$CURDIR/$name")"
sum=${sum%% *}
echo -e "pkgbuild_sha256sum = $sum" >> $PKGDIR/.BUILDINFO
echo -e "packager = $maintainer" >> $PKGDIR/.BUILDINFO
echo -e "builddate = $SOURCE_DATE_EPOCH" >> $PKGDIR/.BUILDINFO
echo -e "builddir = $BUILDDIR" >> $PKGDIR/.BUILDINFO
local pkginfos_parsed=($(LC_ALL=pkexec sh -c "pacman -Qi" | awk -F': ' '\
/^Name .*/ {printf "%s", $2} \
/^Version .*/ {printf "-%s", $2} \
/^Architecture .*/ {print "-"$2} \
'))
write_kv_pair "installed" "${pkginfos_parsed[@]}"
}
_create_metadata(){
__write_pkginfo >> $PKGDIR/.PKGINFO
__write_buildinfo >> $PKGDIR/.BUILDINFO
}
_package(){
cp -prfv $INSTALLDIR/* $PKGDIR/
cd $PKGDIR
#Create .MTREE
list_package_files | LANG=C bsdtar -cnf - --format=mtree \
--options='!all,use-set,type,uid,gid,mode,time,size,md5,sha256,link' \
--null --files-from - --exclude .MTREE | gzip -c -f -n > .MTREE
tar --zstd -cf $CURDIR/$name-$version-$release.pkg.tar.zst * .PKGINFO .BUILDINFO
}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/target/debian 0000664 0000000 0000000 00000002151 13726714240 0023507 0 ustar 00root root 0000000 0000000 #!/bin/bash
_write_metadata(){
echo -e "Package: $name"
#echo -e "Source: $source"
echo -e "Version: $version"
notnull $partof && echo -e "Section: $partof"
notnull $priority && echo -e "Priority: $priority"
echo -e "Architecture: $arch"
echo -e "Maintainer: $maintainer <$email>"
echo -e "Installed-Size: $(du -s $INSTALLDIR | cut -f 1)"
notnull "$depends" && { echo -ne "Depends:"
for dep in ${depends[@]}
do
echo -ne " $dep,"
done | sed "s/,$//g" ; echo
}
echo -e "Homepage: $homepage"
echo -e "Date: $(date +'%d/%m/%Y-%H:%M:%S')"
echo -e "Description: $description\n"
}
_create_metadata(){
mkdir -p $PKGDIR/DEBIAN
if [ -d "$debdir" ]; then
cp -prfv $debdir/* $PKGDIR/DEBIAN
else
_write_metadata > $PKGDIR/DEBIAN/control
fi
find $INSTALLDIR/ -type d | xargs chmod 755
find $INSTALLDIR/ -type f -exec md5sum {} \; > $PKGDIR/md5sums
}
_package(){
cd $INSTALLDIR
tar --gzip -cvf $PKGDIR/data.tar.gz ./*
cd $PKGDIR/DEBIAN
tar --gzip -cvf $PKGDIR/control.tar.gz *
echo "2.0" > $PKGDIR/debian-binary
cd $PKGDIR
ar r "$CURDIR/${name}_${arch}_${version}.deb" debian-binary control.tar.gz data.tar.gz
}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/target/default 0000664 0000000 0000000 00000001772 13726714240 0023721 0 ustar 00root root 0000000 0000000 #!/bin/bash
__write_remove(){
cd $INSTALLDIR
find | sort | while read line
do
if [ -f $line ] ; then
echo "rm -f $line" | sed "s/\.\//\//g"
fi
done
find | sort -r | while read line
do
if [ -d $line ] && [ $line != "." ] ; then
echo "rmdir $line 2>/dev/null" | sed "s/\.\//\//g"
fi
done
echo "rm -f /info/$name"
echo "rm -f /info/$name.remove"
}
_create_metadata(){
mkdir $PKGDIR/info/
echo "----begin----" >> $PKGDIR/info/$name
echo "Build date : $(date)" >> $PKGDIR/info/$name
echo "----info----" >> $PKGDIR/info/$name
echo "Name: $name" >> $PKGDIR/info/$name
echo "Version: $version" >> $PKGDIR/info/$name
echo "Summary: $summary" >> $PKGDIR/info/$name
echo "Description: $description" >> $PKGDIR/info/$name
echo "----files----" >> $PKGDIR/info/$name
cd $INSTALLDIR
find >> $PKGDIR/info/$name
echo "----end----" >> $PKGDIR/info/$name
__write_remove >> $PKGDIR/info/$name.remove
}
_package(){
cp -prfv $INSTALLDIR/* $PKGDIR/
cd $PKGDIR
tar -cf $CURDIR/$name-$version.tar *
}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/target/inary 0000664 0000000 0000000 00000006437 13726714240 0023422 0 ustar 00root root 0000000 0000000 #!/bin/bash
__write_metadata(){
echo -e ""
echo -e " "
echo -e " "
echo -e " "
if [ ! "$partof" == "" ] ; then
echo -e " $partof"
fi
echo -e " $name"
echo -e " $summary"
echo -e " $description"
if [ ! "${#isa[@]}" == "0" ] ; then
for i in ${isa[@]} ; do
echo -e " $i"
done
fi
echo -e " $license"
echo -e " "
for dep in ${depends[@]}
do
echo -e " $dep"
done
echo -e " "
echo -e " "
echo -e " /usr"
echo -e " /etc"
echo -e " /bin"
echo -e " /var"
echo -e " /lib"
echo -e " /boot"
echo -e " "
echo -e " "
echo -e " "
echo -e " $date"
echo -e " $version"
echo -e " Auto generated."
echo -e " $maintainer"
echo -e " $email"
echo -e " "
echo -e " "
echo -e " uludag"
echo -e " Sulin"
echo -e " 2019"
echo -e " $arch"
echo -e " 1"
echo -e " @tarhash@"
echo -e " 1.2"
echo -e " "
echo -e ""
}
_create_metadata(){
__write_metadata >> $PKGDIR/metadata.xml
}
_package(){
cd $INSTALLDIR
[ -f ../install.tar.xz ] && rm -f ../install.tar.xz
tar --xz -cf ../install.tar.xz *
echo -e "" > ../files.xml
find | sed "s|^\./||g" | while read line
do
if [ -f $line ] ; then
echo -e " " >> ../files.xml
echo -e " $line" >> ../files.xml
echo -e " data" >> ../files.xml
echo -e " $(du -b $line | awk '{print $1}')" >> ../files.xml
echo -e " 0" >> ../files.xml
echo -e " 0" >> ../files.xml
echo -e " 0o755" >> ../files.xml
echo -e " $(sha1sum $line | awk '{print $1}')" >> ../files.xml
echo -e " " >> ../files.xml
fi
done
echo -e "" >> ../files.xml
mv ../files.xml $PKGDIR/files.xml
mv ../install.tar.xz $PKGDIR/install.tar.xz
cd $PKGDIR
export installtarhash="$(sha1sum install.tar.xz | awk '{print $1}')"
sed -i "s/@tarhash@/$installtarhash/g" metadata.xml
zip -r $CURDIR/$name-$version.inary *
}
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/src/unibuild.sh 0000664 0000000 0000000 00000003663 13726714240 0023234 0 ustar 00root root 0000000 0000000 #!/bin/bash
declare -r unibuild_api_version=1
declare -r inittime=$(date +%s%3N)
[ -f $HOME/.unibuildrc ] && source $HOME/.unibuildrc
[ "$MODDIR" == "" ] && export MODDIR=/usr/lib/unibuild/modules
set -e
for api in $(ls $MODDIR/../api | sort) ; do
source $MODDIR/../api/$api
done
for mod in $(ls $MODDIR) ; do
source $MODDIR/$mod
done
if [ -f "$1" ] ; then
source <(cat $1)
elif echo "$1" | grep "^.*://" &>/dev/null ; then
source <(curl $1)
else
err "Source not detected or not supported."
exit 1
fi
source $MODDIR/../target/$TARGET
source $MODDIR/../host/$HOST
declare -r begintime=$(date +%s%3N)
msg ">>> Checking dependencies"
_get_build_deps
declare -r checktime=$(date +%s%3N)
cd $BUILDDIR
msg ">>> Getting sources"
_fetch
declare -r fetchtime=$(date +%s%3N)
msg ">>> Running hooks"
for hook in $(ls $MODDIR/../hooks | sort) ; do
source $MODDIR/../hooks/$hook
done
if fn_exists "_setup" ; then
cd $WORKDIR
msg ">>> Running setup function"
_setup
fi
declare -r setuptime=$(date +%s%3N)
if fn_exists "_build" ; then
cd $WORKDIR
msg ">>> Running build function"
_build
fi
declare -r buildtime=$(date +%s%3N)
if fn_exists "_install" ; then
cd $WORKDIR
msg ">>> Running install function"
_install
fi
declare -r installtime=$(date +%s%3N)
cd $WORKDIR
msg ">>> Generating metadata"
_create_metadata
cd $WORKDIR
msg ">>> Creating package"
_package
msg ">>> Clearing workdir"
declare -r packagetime=$(date +%s%3N)
rm -rf $WORKDIR
info ">>> Done"
msg "Unibuild stats (milisec):"
info " Unibuild init: $(($begintime-$inittime))"
info " Package Checking: $(($checktime-$begintime))"
info " Source fetching: $(($fetchtime-$checktime))"
info " Setup functions: $(($setuptime-$fetchtime))"
info " Source Building: $(($buildtime-$setuptime))"
info " Source installing: $(($installtime-$buildtime))"
info " Package generating: $(($packagetime-$installtime))"
info " Total time: $(($packagetime-$inittime))"
unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/uninstall.sh 0000664 0000000 0000000 00000000245 13726714240 0022634 0 ustar 00root root 0000000 0000000 #!/bin/bash
if [ -x $DESTDIR/usr/bin/unibuild ]; then
rm $DESTDIR/usr/bin/unibuild
fi
if [ -d $DESTDIR/usr/lib/unibuild ]; then
rm -r $DESTDIR/usr/lib/unibuild/
fi unibuild-e4349cbf5615ea54a238e94ae742c4496f3ab409/upgrade.sh 0000664 0000000 0000000 00000000055 13726714240 0022251 0 ustar 00root root 0000000 0000000 #!/bin/bash
bash uninstall.sh
bash install.sh