Made several fixes to mksm build file generator

This commit is contained in:
PktSurf 2024-10-28 23:07:24 +05:30
parent efdb78cf28
commit db1913af78

21
mksm
View file

@ -2,7 +2,7 @@
# Part of SMLinux distribution
# Package build file generator
# Copyright (c) 2022-2023 PktSurf <smlinux@pktsurf.in>
# Copyright (c) 2022-2024 PktSurf <smlinux@pktsurf.in>
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@ -19,7 +19,7 @@
# Abort on any error
set -e
mksmversion="0.100"
mksmversion="0.102"
# Date format
filedate="$(date +%Y%m%d%H%M%S)"
@ -44,6 +44,7 @@ Options:
-a : Application name. This option is REQUIRED.
-b : Build system used by the package. This option is REQUIRED.
Supported build systems are autoconf, make, cmake, meson and guess
-h : Show this usage and exit.
@ -114,7 +115,7 @@ if [[ -z $envversion ]] ; then
fi
if [[ -z $envbuildsys ]] ; then
echo "[ERROR] Build system not provided. Please provide one from make, cmake, autoconf or meson."
echo "[ERROR] Build system not provided. Please provide one from make, cmake, autoconf, meson or guess."
exit 1
fi
@ -124,7 +125,7 @@ fi
appname="$envappname"
version="$envversion"
buildfile="$appname.SMBuild"
buildfile="$currentdir/$appname.SMBuild"
# Use case/esac to determine the value of envbuildsys supplied to us. If it isn't what's expected,
# throw an error and exit.
@ -137,7 +138,7 @@ esac
gen_autoconf() {
cat << 'EOF' >> $buildfile
./configure \
--prefix=""
--prefix=/usr
make
make install DESTDIR=$pkg
@ -169,10 +170,7 @@ gen_cmake() {
cat << 'EOF' >> $buildfile
mkdir smbuild && cd smbuild
cmake .. \
-DCMAKE_INSTALL_PREFIX="/" \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-Wno-dev
-DCMAKE_INSTALL_PREFIX="/"
make
make install DESTDIR=$pkg
@ -190,7 +188,7 @@ gen_meson() {
cat << 'EOF' >> $buildfile
mkdir smbuild && cd smbuild
meson .. \
--prefix="/"
--prefix=/usr
ninja
DESTDIR="$pkg" ninja install
@ -222,6 +220,8 @@ gen_guess() {
echo "Looks like meson build system..."
gen_meson
fi
cd $currentdir
rm -rf tmp.dir
else
echo "Non-standard directory. Perhaps you might want to provide a definitive build system"
echo "instead of guessing?"
@ -282,7 +282,6 @@ case "$buildsys" in
guess) gen_guess ;;
esac
chmod +x $buildfile
echo "...done"
echo ""