Skip to content

Commit

Permalink
Merge pull request #106 from ggtakec/update_common_scripts
Browse files Browse the repository at this point in the history
Updated Antpickax common scripts and tools under the buildutils directory
  • Loading branch information
Takeshi Nakatani authored Oct 18, 2022
2 parents 85599f5 + f2ec45e commit 024f815
Show file tree
Hide file tree
Showing 19 changed files with 1,557 additions and 871 deletions.
14 changes: 5 additions & 9 deletions .github/workflows/build_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ fi
# Set variables for packaging
#
if [ "X${OPT_BUILD_NUMBER}" != "X" ]; then
BUILD_NUMBER=${BUILD_NUMBER}
BUILD_NUMBER=${OPT_BUILD_NUMBER}
else
BUILD_NUMBER=1
fi
Expand Down Expand Up @@ -579,18 +579,14 @@ if [ ${PKG_TYPE_RPM} -eq 1 ]; then
#
# Create rpm packages
#
prn_cmd ./buildutils/rpm_build.sh -buildnum ${BUILD_NUMBER} -y
./buildutils/rpm_build.sh -buildnum ${BUILD_NUMBER} -y
prn_cmd CONFIGUREOPT=${CONFIGURE_EXT_OPT} ./buildutils/rpm_build.sh --buildnum ${BUILD_NUMBER} -y
CONFIGUREOPT=${CONFIGURE_EXT_OPT} ./buildutils/rpm_build.sh --buildnum ${BUILD_NUMBER} -y
else
#
# Create debian packages
#
DEBUILD_OPT=""
if [ ${IS_PUBLISH} -ne 1 ]; then
DEBUILD_OPT="-nodebuild"
fi
prn_cmd CONFIGUREOPT=${CONFIGURE_EXT_OPT} ./buildutils/debian_build.sh -buildnum ${BUILD_NUMBER} -disttype ${DIST_TAG} ${DEBUILD_OPT} -y
CONFIGUREOPT=${CONFIGURE_EXT_OPT} ./buildutils/debian_build.sh -buildnum ${BUILD_NUMBER} -disttype ${DIST_TAG} ${DEBUILD_OPT} -y
prn_cmd CONFIGUREOPT=${CONFIGURE_EXT_OPT} ./buildutils/debian_build.sh --buildnum ${BUILD_NUMBER} --disttype ${DIST_TAG} -y
CONFIGUREOPT=${CONFIGURE_EXT_OPT} ./buildutils/debian_build.sh --buildnum ${BUILD_NUMBER} --disttype ${DIST_TAG} -y
fi
if [ $? -ne 0 ]; then
echo "[ERROR] ${PRGNAME} : Failed to build packages"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ COMMIT_HASH
*.k2h
buildutils/control
buildutils/copyright
buildutils/rules
rpmbuild
rpmbuild/*
debian
Expand Down
139 changes: 77 additions & 62 deletions autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,47 @@
# REVISION:
#


#
# Usage: autogen.sh [-noupdate_version_file] [-no_aclocal_force] [-no_check_ver_diff]
# Common variables
#
AUTOGEN_NAME=`basename $0`
AUTOGEN_DIR=`dirname $0`
SRCTOP=`cd ${AUTOGEN_DIR}; pwd`
AUTOGEN_NAME=$(basename "${0}")
AUTOGEN_DIR=$(dirname "${0}")
SRCTOP=$(cd "${AUTOGEN_DIR}" || exit 1; pwd)

echo "** run autogen.sh"
#
# Run
#
echo "[RUN] autogen.sh"
echo ""

#
# Parameter
# Parse parameters
#
NOUPDATE="no"
UPDATE_VERSION_FILE=1
FORCEPARAM="--force"
PARAMETERS=""
while [ $# -ne 0 ]; do
if [ "X$1" = "X-noupdate_version_file" ]; then
NOUPDATE="yes"
FORCEPARAM="" # do not need force
elif [ "X$1" = "X-no_aclocal_force" ]; then
FORCEPARAM=""
elif [ "X$1" = "X-no_check_ver_diff" ]; then
PARAMETERS="${PARAMETERS} $1"
elif [ "X$1" = "X-h" -o "X$1" = "X--help" ]; then
echo "Usage: ${AUTOGEN_NAME} [-noupdate_version_file] [-no_aclocal_force] [-no_check_ver_diff]"
if [ -z "$1" ]; then
echo "[ERROR] Parameters are something wrong."
exit 1

elif [ "$1" = "-h" ] || [ "$1" = "-H" ] || [ "$1" = "--help" ] || [ "$1" = "--HELP" ]; then
echo "Usage: ${AUTOGEN_NAME} [--help(-h)] [--no_update_version_file(-nu)] [--no_aclocal_force(-na)] [--no_check_ver_diff(-nc)]"
exit 0

elif [ "$1" = "-nu" ] || [ "$1" = "-NU" ] || [ "$1" = "--no_update_version_file" ] || [ "$1" = "--NO_UPDATE_VERSION_FILE" ]; then
UPDATE_VERSION_FILE=0
FORCEPARAM="" # do not need force

elif [ "$1" = "-na" ] || [ "$1" = "-NA" ] || [ "$1" = "--no_aclocal_force" ] || [ "$1" = "--NO_ACLOCAL_FORCE" ]; then
FORCEPARAM=""

elif [ "$1" = "-nc" ] || [ "$1" = "-NC" ] || [ "$1" = "--no_check_ver_diff" ] || [ "$1" = "--NO_CHECK_VER_DIFF" ]; then
PARAMETERS="$1"

else
echo "ERROR: Unknown option $1"
echo "Usage: ${AUTOGEN_NAME} [-noupdate_version_file] [-no_aclocal_force] [-no_check_ver_diff]"
echo "[ERROR] Unknown option $1"
echo "Usage: ${AUTOGEN_NAME} [--help(-h)] [--no_update_version_file(-nu)] [--no_aclocal_force(-na)] [--no_check_ver_diff(-nc)]"
exit 1
fi
shift
Expand All @@ -62,88 +73,92 @@ done
#
# update RELEASE_VERSION file
#
if [ "X${NOUPDATE}" = "Xno" ]; then
echo "--- run make_release_version_file.sh"
${SRCTOP}/buildutils/make_release_version_file.sh ${PARAMETERS}
if [ $? -ne 0 ]; then
echo "ERROR: update RELEASE_VERSION file"
if [ "${UPDATE_VERSION_FILE}" -eq 1 ] && [ -f "${SRCTOP}/buildutils/make_release_version_file.sh" ]; then
echo " [INFO] run make_release_version_file.sh"
if ! /bin/sh -c "${SRCTOP}/buildutils/make_release_version_file.sh" "${PARAMETERS}" 2>&1 | sed -e 's|^| |g'; then
echo "[ERROR] update RELEASE_VERSION file"
exit 1
fi
fi

#
# Check files
#
if [ ! -f ${SRCTOP}/NEWS ]; then
touch ${SRCTOP}/NEWS
if [ ! -f "${SRCTOP}/NEWS" ]; then
touch "${SRCTOP}/NEWS"
fi
if [ ! -f ${SRCTOP}/README ]; then
touch ${SRCTOP}/README
if [ ! -f "${SRCTOP}/README" ]; then
touch "${SRCTOP}/README"
fi
if [ ! -f ${SRCTOP}/AUTHORS ]; then
touch ${SRCTOP}/AUTHORS
if [ ! -f "${SRCTOP}/AUTHORS" ]; then
touch "${SRCTOP}/AUTHORS"
fi
if [ ! -f ${SRCTOP}/ChangeLog ]; then
touch ${SRCTOP}/ChangeLog
if [ ! -f "${SRCTOP}/ChangeLog" ]; then
touch "${SRCTOP}/ChangeLog"
fi

#
# Auto scan
#
if [ ! -f configure.scan -o "X${FORCEPARAM}" != "X" ]; then
echo "--- run autoscan"
autoscan
if [ $? -ne 0 ]; then
echo "ERROR: something error occurred in autoscan"
if [ ! -f configure.scan ] || [ -n "${FORCEPARAM}" ]; then
echo " [INFO] run autoscan"
if ! autoscan 2>&1 | sed -e 's|^| |g'; then
echo "[ERROR] something error occurred in autoscan"
exit 1
fi
fi

#
# Copy libtools
#
libtoolize --force --copy
if [ $? -ne 0 ]; then
echo "ERROR: something error occurred in libtoolize"
exit 1
if grep -q 'LT_INIT' configure.ac configure.scan; then
if ! libtoolize --force --copy 2>&1 | sed -e 's|^| |g'; then
echo "[ERROR] something error occurred in libtoolize"
exit 1
fi
fi

#
# Build configure and Makefile
#
echo "--- run aclocal ${FORCEPARAM}"
aclocal ${FORCEPARAM}
if [ $? -ne 0 ]; then
echo "ERROR: something error occurred in aclocal ${FORCEPARAM}"
echo " [INFO] run aclocal ${FORCEPARAM}"
if ! /bin/sh -c "aclocal ${FORCEPARAM}" 2>&1 | sed -e 's|^| |g'; then
echo "[ERROR] something error occurred in aclocal ${FORCEPARAM}"
exit 1
fi

echo "--- run autoheader"
autoheader
if [ $? -ne 0 ]; then
echo "ERROR: something error occurred in autoheader"
exit 1
if grep -q 'AC_CONFIG_HEADERS' configure.ac configure.scan; then
echo " [INFO] run autoheader"
if ! autoheader 2>&1 | sed -e 's|^| |g'; then
echo "[ERROR] something error occurred in autoheader"
exit 1
fi
fi

echo "--- run automake -c --add-missing"
automake -c --add-missing
if [ $? -ne 0 ]; then
echo "ERROR: something error occurred in automake -c --add-missing"
echo " [INFO] run automake -c --add-missing"
if ! automake -c --add-missing 2>&1 | sed -e 's|^| |g'; then
echo "[ERROR] something error occurred in automake -c --add-missing"
exit 1
fi

echo "--- run autoconf"
autoconf
if [ $? -ne 0 ]; then
echo "ERROR: something error occurred in autoconf"
echo " [INFO] run autoconf"
if ! autoconf 2>&1 | sed -e 's|^| |g'; then
echo "[ERROR] something error occurred in autoconf"
exit 1
fi

echo "** SUCCEED: autogen"
#
# Finish
#
echo ""
echo "[SUCCEED] autogen.sh"
exit 0

#
# VIM modelines
#
# vim:set ts=4 fenc=utf-8:
# Local variables:
# tab-width: 4
# c-basic-offset: 4
# End:
# vim600: noexpandtab sw=4 ts=4 fdm=marker
# vim<600: noexpandtab sw=4 ts=4
#
2 changes: 2 additions & 0 deletions buildutils/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ EXTRA_DIST =make_variables.sh \
make_rpm_changelog.sh \
make_description.sh \
debian_build.sh \
debian_build_copy.conf \
rpm_build.sh \
chmpx.install \
chmpx.service \
chmpx-service-helper \
chmpx-service-helper.conf \
Expand Down
34 changes: 34 additions & 0 deletions buildutils/chmpx.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#
# CHMPX
#
# Copyright 2022 Yahoo Japan Corporation.
#
# CHMPX is inprocess data exchange by MQ with consistent hashing.
# CHMPX is made for the purpose of the construction of
# original messaging system and the offer of the client
# library.
# CHMPX transfers messages between the client and the server/
# slave. CHMPX based servers are dispersed by consistent
# hashing and are automatically laid out. As a result, it
# provides a high performance, a high scalability.
#
# For the full copyright and license information, please view
# the license file that was distributed with this source code.
#
# AUTHOR: Takeshi Nakatani
# CREATE: Fri, Oct 13 2022
# REVISION:
#

buildutils/chmpx-service-helper usr/libexec
buildutils/chmpx-service-helper.conf etc/antpickax
buildutils/chmpx.ini.example etc/antpickax

#
# Local variables:
# tab-width: 4
# c-basic-offset: 4
# End:
# vim600: noexpandtab sw=4 ts=4 fdm=marker
# vim<600: noexpandtab sw=4 ts=4
#
4 changes: 2 additions & 2 deletions buildutils/chmpx.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ chmod 0777 /var/run/antpickax
# tab-width: 4
# c-basic-offset: 4
# End:
# vim600: expandtab sw=4 ts=4 fdm=marker
# vim<600: expandtab sw=4 ts=4
# vim600: noexpandtab sw=4 ts=4 fdm=marker
# vim<600: noexpandtab sw=4 ts=4
#
8 changes: 7 additions & 1 deletion buildutils/chmpx.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@
%global make_check 1
%endif

%if %{undefined not_run_autogen}
%global run_autogen ./autogen.sh
%else
%global run_autogen echo "skip autogen.sh"
%endif

#
# main package
#
Expand All @@ -66,7 +72,7 @@ BuildRequires: systemd git-core gcc-c++ make libtool k2hash-devel >= 1.0.74, lib
%autosetup -n %{name}-%{version}

%build
./autogen.sh
%run_autogen
%configure --disable-static @CONFIGUREWITHOPT@
%make_build

Expand Down
Loading

0 comments on commit 024f815

Please sign in to comment.