Skip to content

Commit

Permalink
TOOLS: release gm2xpkg ver 0.4 (#81)
Browse files Browse the repository at this point in the history
* add IPK entries - Depends/Source/License
* check libs interpreter for shared or static build
  • Loading branch information
Apaczer authored Jul 5, 2024
1 parent 05b0f77 commit d9a2374
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
33 changes: 27 additions & 6 deletions tools/gm2xpkg.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

VER=0.3
VER=0.4
MIYOOCFW_VER=2.0.0
# Help & About info
help_func() {
Expand Down Expand Up @@ -48,7 +48,7 @@ do
;;
-V | --ver | --version)
echo -e "GM2X PACKAGER version ${VER} for MiyooCFW ${MIYOOCFW}"
shift
exit 0
;;
-i | --ipk)
IPK_OPT="1"
Expand Down Expand Up @@ -176,25 +176,46 @@ PRIORITY=${PRIORITY:=optional}
MAINTAINER=${MAINTAINER:=Unknown}
CONFFILES=${CONFFILES:=""} # TODO (to preserve & not reinstall user configs)
ARCH=${ARCH:=arm}
DEPENDS=${DEPENDS:=""}
SOURCE=${SOURCE:=""}
LICENSE=${LICENSE:="Unknown"}

#---------------------------------------------#
# CODE execution

LIBS_LD="$(file ${TARGET} | sed -E 's/.* ([^ ]+) linked.*/\1/')"
if test "${LIBS_LD}" == "dynamically"; then
LIBC=$(file ${TARGET} | sed -n 's/.*ld-\([a-zA-Z]*\).*/\1/p' | tr '[:upper:]' '[:lower:]')
DEPENDS="${LIBC}, ${DEPENDS}"
echo "Target binary \"${TARGET}\" is ${LIBS_LD} linked with ${LIBC} libc implementation"
test "${LIBC}" == "uclibc" || test "${LIBC}" == "musl"\
|| bash -c "echo "ERROR:\ The\ \"${LIBC}\"\ is\ invalid\ libs\ interpreter" && sleep 2 && exit 1"
elif test "${LIBS_LD}" == "statically"; then
DEPENDS=""
echo "Target binary \"${TARGET}\" is ${LIBS_LD} linked with no need for externall dependencies"
else
echo "Bad file type or build linking, exiting..."
exit 1
fi

### automate output of CONTROL file
CONTROL="Package: ${TARGET}\n\
Version: ${VERSION}\n\
Depends: ${DEPENDS}\n\
Source: ${SOURCE}\n\
License: ${LICENSE}\n\
Description: ${DESCRI}\n\
Section: ${SECTION}\n\
Priority: ${PRIORITY}\n\
Maintainer: ${MAINTAINER}\n\
Architecture: ${ARCH}"
#---------------------------------------------#
# CODE execution

echo -e "Using following configuration:
PACKAGE=${PACKAGE}\nZIP=${ZIP}\nIPK=${IPK}\nCLEAN=${CLEAN}\n
TARGET=${TARGET}\nVERSION=${VERSION}\n
HOMEPATH=${HOMEPATH}\nRELEASEDIR=${RELEASEDIR}\nASSETSDIR=${ASSETSDIR}\nOPKG_ASSETSDIR=${OPKG_ASSETSDIR}\nLINK=${LINK}\nALIASES=${ALIASES}\nMANUAL=${MANUAL}\n
TITLE=${TITLE}\nDESCRI=${DESCRI}\nSELDIR=${SELDIR}\nDESTDIR=${DESTDIR}\nTARGET_DIR=${TARGET_DIR}\nSECTION=${SECTION}\n
TARGET_DIR=${TITLE}\nDOCS=(${DOCS[*]})\n
PRIORITY=${PRIORITY}\nMAINTAINER=${MAINTAINER}\nCONFFILES=${CONFFILES}\nARCH=${ARCH}\n
PRIORITY=${PRIORITY}\nMAINTAINER=${MAINTAINER}\nCONFFILES=${CONFFILES}\nARCH=${ARCH}\nDEPENDS=${DEPENDS}\nSOURCE=${SOURCE}\nLICENSE=${LICENSE}
"

if ! test -d $ASSETSDIR; then
Expand Down
7 changes: 5 additions & 2 deletions tools/pkg.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# NOTES:
## All variable values should encloused within double qoutes: "<value>"
## CONFIGURATION FILE for `gm2xpkg` script version:
PKGVER="0.3"
PKGVER="0.4"

# EXEC commands (set to "1" anyone for desired outcome), you can instead use [OPTIONS] of `gm2xpkg`:
PACKAGE=""
Expand Down Expand Up @@ -39,4 +39,7 @@ PRIORITY=""
MAINTAINER=""
CONFFILES=""
ARCH="" # default=arm - do not modify for ARM chips
# CONTROL= # automated output of *.ipk control config file
# CONTROL= # automated output of *.ipk control config file
DEPENDS="" # list of dependency packages e.g. ="sdl, libpng" or ="sdl (>= 2.9.2), sdl_mixer (= ed76d39cda0735d26c14a3e4f4da996e420f6478)" provide only for shared libs build, otherwise ignored
SOURCE=""
LICENSE=""

0 comments on commit d9a2374

Please sign in to comment.