Έχω μερικές απορίες σχετικά με το γράψιμο και χτίσιμο μέσω SLKBUILD
και παρακαλώ την βοήθεια σας.
α) Όταν πάρουμε slackbuild scripts τα οποία κατα καιρούς είχαν διάφορα copyright δήλαδή το πρωτο-έγραψε κάποιος και στην συνέχεια το ανάλαβε άλλος και ου το καθ εξής...
Ποιο όνομα βάζω στη θέση
Code: Select all
#Packager: Name <email@address.com>
#Former Packager(s): Name <email@address.com>
Είναι βασικό αυτό για εμένα να γινει σωστά για να μην υπάρξουν παρεξηγήσεις μεταξύ φίλων.
και επι του πρακτέου κάτι ακόμα:
θέλω να χτίσω την libnma-gtk4
το slackbuild script έχει ως εξής στα κομματια που μας ενδιαφέρουν έχει ως εξής:
Code: Select all
Copyright 2020 Patrick J. Volkerding, Sebeka, Minnesota, USA
# Modifications 2022 Jay Lanagan (j@lngn.net), Detroit, MI, USA.
# All rights reserved.
Code: Select all
SRCNAM=libnma
PKGNAM=libnma-gtk4
VERSION=${VERSION:-1.10.6}
BUILD=${BUILD:-2}
Code: Select all
export CFLAGS="$SLKCFLAGS"
export CXXFLAGS="$SLKCFLAGS"
mkdir build
cd build
meson setup \
--prefix=/usr \
--libdir=lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
-Dlibnma_gtk4=true \
.. || exit 1
"${NINJA:=ninja}" $NUMJOBS || exit 1
DESTDIR=$PKG $NINJA install || exit 1
cd ..
είναι:
Code: Select all
#Packager: Anagnostakis Ioannis <rizitis@gmail.com>
#Former Packager(s): Jay Lanagan <j@lngn.net>
#Anything commented out is optional and can be deleted.
pkgname=libnma
pkgver=1.10.6
pkgrel=1
source=("libnma-1.10.6.tar.xz" "gschema-Remove-path-from-eap-schema.patch")
doinst() {
if [ -e usr/share/glib-2.0/schemas ]; then
if [ -x /usr/bin/glib-compile-schemas ]; then
/usr/bin/glib-compile-schemas usr/share/glib-2.0/schemas >/dev/null 2>&1
fi
fi
}
slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"The libnma-gtk4 library provides an API used to create dialogs for"
"NetworkManager clients such as network-manager-applet."
)
build() {
cd $startdir/src/$pkgname-$pkgver
meson setup \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--infodir=/usr/info \
--localstatedir=/var \
--mandir=/usr/man \
--sysconfdir=/etc \
-Dlibnma_gtk4=true \
--strip \
build
meson compile -C build -j $numjobs
meson install -C build --destdir $startdir/pkg/
}
Code: Select all
#!/bin/bash -p
#Automatically Created by slkbuild 1.2
#Packager: Anagnostakis Ioannis <rizitis@gmail.com>
#Former Packager(s): Jay Lanagan <j@lngn.net>
###Variables
startdir=$(pwd)
SRC=$startdir/src
PKG=$startdir/pkg
pkgname=libnma
pkgver=1.10.6
pkgrel=1
arch=x86_64
numjobs=1
package=$pkgname-$pkgver-$arch-1
source=("libnma-1.10.6.tar.xz" "gschema-Remove-path-from-eap-schema.patch")
docs=()
export CFLAGS="-O2 -fPIC"
export CXXFLAGS="-O2 -fPIC"
export SLKCFLAGS="-O2 -fPIC"
export LIBDIRSUFFIX="64"
export ARCH="x86_64"
######Begin Redundant Code######################################
check_for_root() {
if [ "$UID" != "0" ]; then
echo -e "\nERROR: You need to be root. Using fakeroot is usually preferable."
echo "Example command: fakeroot slkbuild -X"
exit 1
fi
}
clean_dirs () {
for COMPLETED in src pkg; do
if [ -e $COMPLETED ]; then
rm -rf $COMPLETED
fi
done
}
clean_old_builds () {
rm -rf $package.{t[xlgb]z,tbr,md5}
clean_dirs
}
set_pre_permissions() {
cd $startdir/src
find -L . \( \
-perm 777 \
-o -perm 775 \
-o -perm 750 \
-o -perm 711 \
-o -perm 555 \
-o -perm 511 \) \
-print0 | \
xargs -0r chmod 755
find -L . \( \
-perm 666 \
-o -perm 664 \
-o -perm 640 \
-o -perm 600 \
-o -perm 444 \
-o -perm 440 \
-o -perm 400 \) \
-print0 | \
xargs -0r chmod 644
}
remove_libtool_archives() {
[ -d $startdir/pkg/lib${LIBDIRSUFFIX} ] && \
find $startdir/pkg/lib${LIBDIRSUFFIX} -name "*.la" -delete
[ -d $startdir/pkg/usr/lib${LIBDIRSUFFIX} ] && \
find $startdir/pkg/usr/lib${LIBDIRSUFFIX} -name "*.la" -delete
}
gzip_man_and_info_pages() {
for DOCS in man info; do
if [ -d "$startdir/pkg/usr/share/$DOCS" ]; then
mv $startdir/pkg/usr/share/$DOCS $startdir/pkg/usr/$DOCS
if [[ ! "$(ls $startdir/pkg/usr/share)" ]]; then
rm -rf $startdir/pkg/usr/share
fi
fi
if [ -d "$startdir/pkg/usr/$DOCS" ]; then
# I've never seen symlinks in info pages....
if [ "$DOCS" == "man" ]; then
(cd $startdir/pkg/usr/$DOCS
for manpagedir in $(find . -type d -name "man*" 2> /dev/null) ; do
( cd $manpagedir
for eachpage in $( find . -type l -maxdepth 1 2> /dev/null) ; do
ln -s $( readlink $eachpage ).gz $eachpage.gz
rm $eachpage
done )
done)
fi
find $startdir/pkg/usr/$DOCS -type f -exec gzip -9 '{}' \;
fi
done
[ -a $startdir/pkg/usr/info/dir.gz ] && rm -f $startdir/pkg/usr/info/dir.gz
}
set_post_permissions() {
for DIRS in usr/share/icons usr/doc; do
if [ -d "$startdir/pkg/$DIRS" ]; then
if [ "$DIRS" == "usr/doc" ]; then
find -L $startdir/pkg/$DIRS -type f -print0 | \
xargs -0r chmod 644
find -L $startdir/pkg/$DIRS -type d -print0 | \
xargs -0r chmod 755
fi
fi
[ -d $startdir/pkg/$DIRS ] && chown root:root -R $startdir/pkg/$DIRS
done
[ -d $startdir/pkg/usr/bin ] && find $startdir/pkg/usr/bin -user root -group bin -exec chown root:root {} \;
}
copy_build_script() {
mkdir -p $startdir/pkg/usr/src/$pkgname-$pkgver/
[ -f $startdir/SLKBUILD ] && cp $startdir/SLKBUILD $startdir/pkg/usr/src/$pkgname-$pkgver/SLKBUILD
}
create_package() {
ls -lR $startdir/pkg
cd $startdir/pkg
/sbin/makepkg -p -l y -c n $startdir/$package.txz
cd $startdir
md5sum $package.txz > $startdir/$package.md5
}
strip_binaries() {
cd $startdir/pkg
find . -print0 | \
xargs -0r file | \
grep -e "executable" -e "shared object" | \
grep ELF | \
cut -f 1 -d : | \
xargs strip --strip-unneeded 2> /dev/null || true
}
#########End Redundant Code#####################################
#########Begin Non Redundant Code##############################
prepare_directory() {
NOSRCPACK=""
mkdir $startdir/src
mkdir -p $startdir/pkg/usr/src/$pkgname-$pkgver
for SOURCES in ${source[@]}; do
protocol=$(echo $SOURCES | sed 's|:.*||')
file=$(basename $SOURCES | awk -F= '{print $NF}')
if [ ! -f "$file" ]; then
if [ "$protocol" = "http" -o "$protocol" = "https" -o "$protocol" = "ftp" ]; then
echo -e "\nDownloading $(basename $SOURCES)\n"
wget -c --no-check-certificate $SOURCES -O $file
if [ ! "$?" == "0" ]; then
echo "Download failed"
exit 2
fi
else
echo "$SOURCES does not appear to be a url nor is it in the directory"
exit 2
fi
fi
cp -LR $file $startdir/src
if ! [ "$protocol" = "http" -o "$protocol" = "https" -o "$protocol" = "ftp" ]; then
if ! [[ $NOSRCPACK -eq 1 ]]; then
cp -LR $startdir/$(basename $SOURCES) $startdir/pkg/usr/src/$pkgname-$pkgver/
fi
fi
done
}
extract_source() {
cd $startdir/src
if [[ "$(ls $startdir/src)" ]]; then
for FILES in ${source[@]}; do
FILES="$(basename $FILES | awk -F= '{print $NF}')"
file_type=$(file -biLz "$FILES")
unset cmd
case "$file_type" in
*application/x-tar*)
cmd="tar -xf" ;;
*application/x-zip*)
cmd="unzip" ;;
*application/zip*)
cmd="unzip" ;;
*application/x-gzip*)
cmd="gunzip -d -f" ;;
*application/x-bzip*)
cmd="bunzip2 -f" ;;
*application/x-xz*)
cmd="xz -d -f" ;;
*application/x-lzma*)
cmd="lzma -d -f" ;;
*application/x-rar*)
cmd="unrar x" ;;
esac
if [ "$cmd" != "" ]; then
echo "$cmd $FILES"
$cmd $FILES
fi
done
elif [ ! "$source" ]; then
echo -n "" # lame fix
else
echo "no files in the src directory $startdir/src"
exit 2
fi
}
build ()
{
cd $startdir/src/$pkgname-$pkgver;
meson setup --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX} --infodir=/usr/info --localstatedir=/var --mandir=/usr/man --sysconfdir=/etc -Dlibnma_gtk4=true --strip build;
meson compile -C build -j $numjobs;
meson install -C build --destdir $startdir/pkg/
}
create_slackdesc() {
mkdir $startdir/pkg/install
cat <<"EODESC" >$startdir/pkg/install/slack-desc
libnma: The libnma-gtk4 library provides an API used to create dialogs for
libnma:
libnma: NetworkManager clients such as network-manager-applet.
libnma:
libnma:
libnma:
libnma:
libnma:
libnma:
libnma:
libnma:
EODESC
}
setup_doinst() {
cat <<"EODOINST" >>$startdir/pkg/install/doinst.sh
doinst ()
{
if [ -e usr/share/glib-2.0/schemas ]; then
if [ -x /usr/bin/glib-compile-schemas ]; then
/usr/bin/glib-compile-schemas usr/share/glib-2.0/schemas > /dev/null 2>&1;
fi;
fi
}
doinst
EODOINST
}
create_source_file(){
[ -f $package.src ] && rm $package.src
if [ ! -z $sourcetemplate ]; then
echo $sourcetemplate/SLKBUILD >> $package.src
for SOURCES in ${source[@]}; do
protocol=$(echo $SOURCES | sed 's|:.*||')
if ! [ "$protocol" = "http" -o "$protocol" = "https" -o "$protocol" = "ftp" ]; then
if [ ! -z $sourcetemplate ]; then
echo $sourcetemplate/$(basename $SOURCES) >> $package.src
else
echo $(basename $SOURCES) >> $package.src
fi
else
echo $SOURCES >> $package.src
fi
done
fi
}
post_checks(){
# Ideas taken from src2pkg :)
if [ -d "$startdir/pkg/usr/doc/$pkgname-$pkgver" ]; then
for DIRS in usr/doc/$pkgname-$pkgver usr/doc; do
cd $startdir/pkg/$DIRS
if [[ $(find . -type f) = "" ]] ; then
cd ..
rmdir $DIRS
fi
done
fi
# if the docs weren't deleted ...
if [ -d "$startdir/pkg/usr/doc/$pkgname-$pkgver" ]; then
cd $startdir/pkg/usr/doc/$pkgname-$pkgver
#remove zero length files
if [[ $(find . -type f -size 0) ]]; then
echo "Removing some zero lenght files"
find . -type f -size 0 -exec rm -f {} \;
fi
fi
# check if we need to add code to handle info pages
if [[ -d $startdir/pkg/usr/info ]] && [[ ! $(grep install-info $startdir/pkg/install/doinst.sh &> /dev/null) ]] ; then
echo "Found info files - Adding install-info command to doinst.sh"
INFO_LIST=$(ls -1 $startdir/pkg/usr/info)
echo "" >> $startdir/pkg/install/doinst.sh
echo "if [ -x usr/bin/install-info ] ; then" >> $startdir/pkg/install/doinst.sh
for page in $(echo $INFO_LIST) ; do
echo " usr/bin/install-info --info-dir=usr/info usr/info/$page 2>/dev/null" >> $startdir/pkg/install/doinst.sh
done
echo "fi" >> $startdir/pkg/install/doinst.sh
fi
[[ -e $startdir/pkg/usr/info/dir ]] && rm -f $startdir/pkg/usr/info/dir
if [ -d $startdir/pkg/etc ]; then
cd $startdir/pkg/
for conf in $(find ./etc -type f) ; do
conf=${conf: 2}
dotnew=( "${dotnew[@]}" "$conf" )
done
fi
if [[ "$dotnew" ]]; then
for files in ${dotnew[@]} ; do
fullfile="${startdir}/pkg/${files}"
if [ -e "$fullfile" ]; then
mv $fullfile ${fullfile}.new
else
echo "$fullfile was not found"
exit 2
fi
done
cat<<"EODOTNEW" >>$startdir/pkg/install/doinst.sh
#Added by slkbuild 1.2
dotnew() {
NEW="${1}.new"
OLD="$1"
if [ ! -e $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
rm $NEW
fi
}
EODOTNEW
for i in ${dotnew[@]}; do
echo "dotnew $i" >> $startdir/pkg/install/doinst.sh
done
fi
}
####End Non Redundant Code############################
#Execution
check_for_root
clean_old_builds
prepare_directory
extract_source
set_pre_permissions
build
if [ ! "$?" = "0" ]; then
echo "build() failed."
exit 2
fi
create_slackdesc
post_checks
setup_doinst
remove_libtool_archives
strip_binaries
gzip_man_and_info_pages
set_post_permissions
copy_build_script
create_package
create_source_file
echo "Package has been built."
Code: Select all
root@#~> sh build-libnma.sh
build-libnma.sh: line 213: cd: /home/omen/Workspace/Gnome42/libnma-gtk4/src/libnma-1.10.6: No such file or directory
ERROR: Neither directory contains a build file meson.build.
ERROR: Current directory is not a meson build directory: `/home/omen/Workspace/Gnome42/libnma-gtk4/src/build`.
Please specify a valid build dir or change the working directory to it.
It is also possible that the build directory was generated with an old
meson version. Please regenerate it in this case.
Install data not found. Run this command in build directory root.
build() failed.
root@#~>
το pkg
Code: Select all
pwd
/home/omen/Workspace/Gnome42/libnma-gtk4/pkg/usr/src/libnma-1.10.6
omen@$~> ls
gschema-Remove-path-from-eap-schema.patch* libnma-1.10.6.tar.xz
Code: Select all
omen@$~> pwd
/home/omen/Workspace/Gnome42/libnma-gtk4/src
omen@$~> ls
build/ gschema-Remove-path-from-eap-schema.patch* libnma-1.10.6.tar.xz
omen@$~> ls build/
omen@$~>
τι κάνω λάθος?
επίσης πως θα μπορούσε το binary που θα εξαχθεί να ονομάζεται libnma-gtk4 σε ποιο πέδίο πρέπει να μπει αυτή η παράμετρος;
εννοώ η γραμμή 127 του build.sh είναι
/sbin/makepkg -p -l y -c n $startdir/$package-gtk4.txz
ευχαριστώ πολύ.