Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rootTHC committed Jul 4, 2022
1 parent 30ecac5 commit 8e95e11
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 78 deletions.
23 changes: 17 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dnl Process this File with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([gsocket],[1.4.36])
AC_INIT([gsocket],[1.4.37])
AC_CONFIG_AUX_DIR(config)
AC_CANONICAL_TARGET

Expand Down Expand Up @@ -32,7 +32,6 @@ fi
test "x$prefix" != "xNONE" || prefix="/usr/local"
test "x$exec_prefix" != "xNONE" || exec_prefix="${prefix}"


dnl Do "gcc -xc -E -v -" to figure out default paths
dnl Scenarios
dnl --prefix=$HOME/usr => -I$HOME/usr/include /usr/include /usr/local/include
Expand All @@ -42,8 +41,18 @@ dnl --prefix=/usr/local --includedir=$HOME/usr/include => -I$HOME/usr/include /u
dnl default: PREFIX/include unless --includedir=

dnl Try include paths (especially on OSX)
trydir_i="${includedir} ${prefix}/include /usr/local/include /usr/local/opt/openssl/include /opt/homebrew/opt/openssl/include"
for xincdir in $trydir_i ; do
dnl Special consideration if openssl/srp.h exist in $HOME/usr/include
dnl and also the /usr/include/openssl exists. GCC shall use
dnl $HOME/usr/include/openssl/srp.h first but not if $prefix is /usr or any
dnl of the default system paths
dnl To make everyone happy we have to consider:
dnl --prefix=$HOME/usr => Must _first_ add $HOME/usr/include
dnl --prefix=/usr => Must _never_ add /usr/include (or _last_)

test "x$prefix" != "x/usr" && test "x$prefix" != "x/usr/local" && trydir_i="${prefix}/include"
trydir_i="${trydir_i} /usr/local/opt/openssl/include /opt/homebrew/opt/openssl/include"

for xincdir in $includedir $trydir_i ; do
if test ! -d "$xincdir" ; then
continue;
fi
Expand All @@ -56,8 +65,9 @@ done
CPPFLAGS="-I${srcdir}/../include ${INCLUDES} $CPPFLAGS"

dnl Try library paths...
trydir_l="${libdir} ${prefix}/lib /usr/local/lib /usr/local/opt/openssl/lib /opt/homebrew/opt/openssl/lib"
for xlibdir in $trydir_l ; do
test "x$prefix" != "x/usr" && test "x$prefix" != "x/usr/local" && trydir_l="${prefix}/lib"
trydir_l="${trydir_l} /usr/local/opt/openssl/lib /opt/homebrew/opt/openssl/lib"
for xlibdir in $libdir $trydir_l ; do
if test ! -d "$xlibdir" ; then
continue;
fi
Expand Down Expand Up @@ -241,6 +251,7 @@ echo "
${PACKAGE_NAME}-${PACKAGE_VERSION} has been configured:

Host..............: ${host}
Prefix............: ${prefix}
Compiler..........: ${CC}
Compiler flags....: ${CFLAGS_STATIC}${CFLAGS}
Preprocessor flags: ${CPPFLAGS}
Expand Down
6 changes: 1 addition & 5 deletions deploy/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ install_system_systemd()
{
[[ ! -d "${GS_PREFIX}/etc/systemd/system" ]] && return
command -v systemctl >/dev/null || return
systemctl is-system-running &>/dev/null || return
if [[ -f "${SERVICE_FILE}" ]]; then
IS_INSTALLED=1
IS_SKIPPED=1
Expand Down Expand Up @@ -519,14 +520,9 @@ WantedBy=multi-user.target" >"${SERVICE_FILE}"
chmod 600 "${SERVICE_FILE}"
gs_secret_write "$SYSTEMD_SEC_FILE"

# (systemctl enable "${SERVICE_HIDDEN_NAME}" && \
# systemctl start "${SERVICE_HIDDEN_NAME}" && \
# systemctl is-active "${SERVICE_HIDDEN_NAME}") &>/dev/null || { systemctl disable "${SERVICE_HIDDEN_NAME}" 2>/dev/null; rm -f "${SERVICE_FILE}"; return; } # did not work...

systemctl enable "${SERVICE_HIDDEN_NAME}" &>/dev/null || { rm -f "${SERVICE_FILE}"; return; } # did not work...

IS_SYSTEMD=1
# IS_GS_RUNNING=1
IS_INSTALLED=1
}

Expand Down
8 changes: 5 additions & 3 deletions packaging/gsnc-deploy-bin/docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ test -d /gsocket-build || { echo >&2 "/gsocket-build does not exists."; exit 255

cd /gsocket-src && \
./configure --prefix=/root/usr --enable-static $(cat /gsocket-src/configure-parameters.txt) && \
make clean all
strip tools/gs-netcat
make clean all && \
strip tools/gs-netcat && \
# Test execute the binary (unless cross compiler)
grep host /gsocket-src/configure-parameters.txt >/dev/null || tools/gs-netcat -g || { rm -f tools/gs-netcat; exit 255; }
{ grep host /gsocket-src/configure-parameters.txt >/dev/null || tools/gs-netcat -g || { rm -f tools/gs-netcat; exit 255; }; } && exit

exit 255
23 changes: 13 additions & 10 deletions packaging/gsnc-deploy-bin/docker/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,22 @@ docker_pack()
[[ -f "${dsttar}" ]] && { echo >&2 "${filename} exists. Skipping."; return; }
rm -f "${dsttar}"
# Create local docker container if it does not yet exist
docker run --rm -it "${dockername}" true || docker build -t "${dockername}" "${1}" || { exit 255; }
docker run --rm -it "${dockername}" true 2>/dev/null || ( cd docker && docker build -t "${dockername}" "${1}" ) || { exit 255; }

[[ -f "${SRCDIR}/tools/gs-netcat" ]] && rm -f "${SRCDIR}/tools/gs-netcat"
docker run --rm -v "${SRCDIR}:/gsocket-src" -v "${GSNCROOT}:/gsocket-build" -it "${dockername}" /gsocket-build/build.sh || { exit 255; }
(cd "${SRCDIR}/tools" && ${GTAR_BIN} cfz "${dsttar}" --owner=0 --group=0 gs-netcat)
(cd "${SRCDIR}/tools" && ${GTAR_BIN} cfz "${dsttar}" --mode=755 --owner=0 --group=0 gs-netcat)
(cd "${dstdir}" && shasum "${filename}" && ls -al "${filename}")
}

docker_pack x86_64-alpine
docker_pack mips32-alpine "--host mips32"
docker_pack mips64-alpine "--host mips64"
#docker_pack x86_64-centos
docker_pack i386-alpine
#docker_pack i386-debian
docker_pack x86_64-debian
# docker_pack x86_64-arch # NOT SUPPORTED. configure fails with "This script requires a shell more modern than all"
cd "${BASEDIR}/packaging/gsnc-deploy-bin"
docker_pack armv6l-linux "--host=armv6l" && \
docker_pack aarch64-linux "--host=aarch64" && \
docker_pack mips64-alpine "--host=mips64" && \
docker_pack mips32-alpine "--host=mips32" && \
docker_pack x86_64-alpine && \
docker_pack i386-alpine && \
docker_pack x86_64-debian && \
{ echo "SUCCESS"; exit 0; }

exit 255
16 changes: 0 additions & 16 deletions packaging/gsnc-deploy-bin/docker/i386-debian/Dockerfile

This file was deleted.

12 changes: 0 additions & 12 deletions packaging/gsnc-deploy-bin/docker/x86_64-arch/Dockerfile

This file was deleted.

18 changes: 0 additions & 18 deletions packaging/gsnc-deploy-bin/docker/x86_64-centos/Dockerfile

This file was deleted.

1 change: 1 addition & 0 deletions packaging/gsnc-deploy-bin/selftest/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ BASEDIR="$(cd "$(dirname "${0}")" || exit; pwd)"
# IF this is not a live test then use local binaries (GS_DEBUG=1)
if test -z "$GS_LIVE"; then
export GS_DEBUG=1
export GS_USELOCAL=1
${BASEDIR}/deploy.sh && \
GS_UNDO=1 ${BASEDIR}/deploy.sh
else
Expand Down
4 changes: 2 additions & 2 deletions packaging/openwrt/gsocket/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=gsocket
PKG_VERSION:=1.4.36
PKG_VERSION:=1.4.37
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/hackerschoice/gsocket/releases/download/v$(PKG_VERSION)/
PKG_HASH:=89d3c1ac21486c9deb1a08ac10cc6b722a19801163dad4d8b57c1aa8a18f32b8
PKG_HASH:=4f64f71a7d6b8be79754e7bf2109675ffc8a3e37a4a55b08c95a1b1d25e458e5

PKG_MAINTAINER:=Ralf Kaiser <[email protected]>
PKG_LICENSE:=BSD-2-Clause
Expand Down
13 changes: 9 additions & 4 deletions packaging/openwrt/release.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
#! /bin/bash

BASEDIR="$(cd "$(dirname "${0}")" || exit; pwd)"
BASEDIR="$(cd "$(dirname "${0}")" || exit; pwd)" # r/gsocket/packaging/openwrt
source "${BASEDIR}/../../test-build/build_inc.sh"


OPENWRT_vars_init

[[ ! -d "$OWRT_FEEDDIR" ]] && ERREXIT "Not found: $OWRT_FEEDDIR"
[[ -z $OWRT_FEEDDIR ]] && ERREXIT "OWRT_FEEDDIR is empty. ~/research/openwrt not exist?"

[[ ! -d "$OWRT_FEEDDIR/net/gsocket" ]] && mkdir -p "${OWRT_FEEDDIR}/net/gsocket"
OPENWRT_update_makefile

cp "${BASEDIR}/gsocket/Makefile" "${OWRT_FEEDDIR}"
# from r/gsocket/packaging/openwrt/gsocket/* to /r/openwrt/packages/net/gsocket
cp "${BASEDIR}/gsocket/Makefile" "${OWRT_FEEDDIR}/net/gsocket"
cp "${BASEDIR}/gsocket/test.sh" "${OWRT_FEEDDIR}/net/gsocket"

echo "Press enter to push release $VER"
read
(cd "$OWRT_FEEDDIR" && \
(cd "$OWRT_FEEDDIR/net/gsocket" && \
git add Makefile test.sh && \
git commit --amend --author="Ralf Kaiser <[email protected]>" --no-edit --signoff -m "gsocket: upstream update to $VER" && \
git push --force-with-lease origin master)

Expand Down
4 changes: 2 additions & 2 deletions test-build/build_inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ OPENWRT_vars_init()
MKFILE="${TOPDIR}/packaging/openwrt/gsocket/Makefile"
OWRT_PKG_VERSION="$(grep ^PKG_VERSION: "${MKFILE}" | cut -f2 -d=)"
OWRT_PKG_HASH="$(grep ^PKG_HASH: "${MKFILE}" | cut -f2 -d=)"
OWRT_FEEDDIR="$(cd "${TOPDIR}/../openwrt/packages/net/gsocket" || exit; pwd)"

# mdir ~/resarch/openwrt && cd ~/research/openwrt && git clone --depth 1 [email protected]:SkyperTHC/packages.git
OWRT_FEEDDIR="$(cd "${TOPDIR}/../openwrt/packages" || exit; pwd)"
}

OPENWRT_update_makefile()
Expand Down
3 changes: 3 additions & 0 deletions test-build/build_openwrt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ source "${BASEDIR}/build_inc.sh"

OPENWRT_vars_init

[[ "$(hostname)" != "debian-10-6" ]] && ERREXIT "Execute on debian22016"

[[ "$VER" != "$OWRT_PKG_VERSION" ]] || [[ "$HASH" != "$OWRT_PKG_HASH" ]] && OPENWRT_update_makefile

cp "${FILE}" "${OPENWRTDIR}/dl"

cd "$OPENWRTDIR" && nice make -j1 package/gsocket/clean && make -j1 V=sc package/gsocket/compile && exit 0

# FAILED
Expand Down

0 comments on commit 8e95e11

Please sign in to comment.