commit 364d2fd412e498dfd49c3f8390d8367b832abd1d Author: Stanislav N. aka pztrn Date: Sat Mar 4 00:49:28 2023 +0500 Initial commit. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ee05946 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.config +.vscode +data +dist +src diff --git a/README.md b/README.md new file mode 100644 index 0000000..e9c8c52 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# FIDOIP + +This repository contains set of scripts that will help you to get fidoip node up and running. + +**Currently able to work only as point!** + +## Requirements + +### Building fido software + +* autotools +* cmake +* hunspell +* git +* GNU awk +* iconv +* patchelf + +### Runtime + +* Bash 5+. +* xdg-open (for opening links in GoldED+). + +## Using + +First, build full stack with: + +```shell +./fido build +``` diff --git a/fidoip b/fidoip new file mode 100755 index 0000000..4a12134 --- /dev/null +++ b/fidoip @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +# shellcheck disable=SC2046,SC1091 +ROOTDIR="$(dirname $(realpath -s $0))" + +echo ". Running from \"${ROOTDIR}\"" + +source "${ROOTDIR}/scripts/binkd.sh" +source "${ROOTDIR}/scripts/configure.sh" +source "${ROOTDIR}/scripts/golded.sh" +source "${ROOTDIR}/scripts/help.sh" +source "${ROOTDIR}/scripts/husky_build.sh" +source "${ROOTDIR}/scripts/husky_configure.sh" +source "${ROOTDIR}/scripts/sync.sh" + +case $1 in +build) + shift + binkd_build "$@" + husky_build "$@" + golded_build "$@" + ;; +build_binkd) + shift + binkd_build "$@" + ;; +build_golded) + golded_build + ;; +build_husky) + shift + husky_build "$@" + ;; +configure) + configure_start + binkd_configure + husky_configure + golded_configure + ;; +golded) + golded_start + ;; +setup) + shift + binkd_build "$@" + husky_build "$@" + golded_build "$@" + binkd_configure + husky_configure + golded_configure + ;; +sync) + sync + ;; +*) + help_show + ;; +esac diff --git a/patches/bsopack.patch b/patches/bsopack.patch new file mode 100644 index 0000000..0a9aafb --- /dev/null +++ b/patches/bsopack.patch @@ -0,0 +1,123 @@ +From dfb746cfd54f2e256983a048762d89f936ade5ff Mon Sep 17 00:00:00 2001 +From: Eugene Lamskoy +Date: Sat, 18 Dec 2021 13:09:35 +0200 +Subject: [PATCH 1/2] Added CMakeLists.txt to be able to compile with cmake + +--- + CMakeLists.txt | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 85 insertions(+) + create mode 100644 CMakeLists.txt + +diff --git a/CMakeLists.txt b/CMakeLists.txt +new file mode 100644 +index 0000000..9ee4d61 +--- /dev/null ++++ b/CMakeLists.txt +@@ -0,0 +1,85 @@ ++cmake_minimum_required(VERSION 2.8.11) ++PROJECT(sqpack C) ++set(CMAKE_INCLUDE_CURRENT_DIR ON) ++ ++option(BUILD_SHARED_LIBS "Build shared libs" ON) ++ ++if(CMAKE_BUILD_TYPE MATCHES Debug) ++ ADD_DEFINITIONS(-g -DDEBUG -D_DEBUG) ++ set(CMAKE_CONFIGURATION_TYPES "Debug" CACHE STRING "My multi config types" FORCE) ++else(CMAKE_BUILD_TYPE MATCHES Debug) ++ ADD_DEFINITIONS(-DNDEBUG) ++ set(CMAKE_CONFIGURATION_TYPES "Release" CACHE STRING "My multi config types" FORCE) ++endif(CMAKE_BUILD_TYPE MATCHES Debug) ++ ++if (MSVC) ++ if (BUILD_SHARED_LIBS) ++ ADD_DEFINITIONS(-D_DLL -D_MAKE_DLL) ++ else() ++ set(CompilerFlags ++ CMAKE_CXX_FLAGS ++ CMAKE_CXX_FLAGS_DEBUG ++ CMAKE_CXX_FLAGS_RELEASE ++ CMAKE_C_FLAGS ++ CMAKE_C_FLAGS_DEBUG ++ CMAKE_C_FLAGS_RELEASE ++ ) ++ foreach(CompilerFlag ${CompilerFlags}) ++ string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") ++ endforeach() ++ endif() ++ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../out/lib") ++ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../out/bin") ++ ADD_DEFINITIONS(-DWIN32 -D_WINDOWS -D_CONSOLE -D_CRT_SECURE_NO_WARNINGS) ++ include_directories("${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/../huskylib;${CMAKE_CURRENT_SOURCE_DIR}/../fidoconf;${CMAKE_CURRENT_SOURCE_DIR}/../smapi;") ++ if(CMAKE_BUILD_TYPE MATCHES Debug) ++ list( APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../out/lib/Debug" ) ++ else(CMAKE_BUILD_TYPE MATCHES Debug) ++ list( APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../out/lib/Release" ) ++ endif(CMAKE_BUILD_TYPE MATCHES Debug) ++else () ++ if (NOT BUILD_SHARED_LIBS) ++ SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") ++ endif() ++ include_directories("${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/h;${CMAKE_CURRENT_SOURCE_DIR}/../huskylib;${CMAKE_CURRENT_SOURCE_DIR}/../fidoconf;${CMAKE_CURRENT_SOURCE_DIR}/../smapi;") ++ ADD_DEFINITIONS(-Wall -DUNIX) ++endif (MSVC) ++ ++find_library(husky_LIB NAMES husky PATHS "${CMAKE_FIND_ROOT_PATH}") ++find_library(fidoconfig_LIB NAMES fidoconfig PATHS "${CMAKE_FIND_ROOT_PATH}") ++find_library(smapi_LIB NAMES smapi PATHS "${CMAKE_FIND_ROOT_PATH}") ++ ++message("-------------------------") ++message("System : ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION}") ++message("Compiler : ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}") ++message("Prefix : ${CMAKE_INSTALL_PREFIX} (run \"cmake . -DCMAKE_INSTALL_PREFIX:PATH=/other\" for other prefix)") ++message("libhusky : ${husky_LIB}") ++message("libfidoconfig : ${fidoconfig_LIB}") ++message("libsmapi : ${smapi_LIB}") ++message("Build shared : ${BUILD_SHARED_LIBS}") ++message("Build type : ${CMAKE_CONFIGURATION_TYPES}") ++message("-------------------------") ++ ++ADD_EXECUTABLE(bsopack ++ src/config.c src/bsoutil.c src/bsopack.c ++) ++target_link_libraries(bsopack ${fidoconfig_LIB} ${smapi_LIB} ${husky_LIB}) ++ ++ INSTALL(TARGETS bsopack ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ) ++if (NOT MSVC) ++ set(CPACK_GENERATOR ${CPACK_GENERATOR} TGZ) ++else() ++ set(CPACK_GENERATOR ${CPACK_GENERATOR} 7Z) ++endif (NOT MSVC) ++ ++set (CPACK_STRIP_FILES TRUE) ++set (CPACK_PACKAGE_VERSION_MAJOR "1") ++set (CPACK_PACKAGE_VERSION_MINOR "9") ++file(READ cvsdate.h CPACK_PACKAGE_VERSION_PATCH LIMIT 10 OFFSET 17) ++string(SUBSTRING ${CPACK_PACKAGE_VERSION_PATCH} 0 10 CPACK_PACKAGE_VERSION_PATCH) ++string(REGEX REPLACE "-" "" CPACK_PACKAGE_VERSION_PATCH ${CPACK_PACKAGE_VERSION_PATCH}) ++set (CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE) ++INCLUDE(CPack) + +From 803ee4d24204608cf450e374e056c6d612f6f9c0 Mon Sep 17 00:00:00 2001 +From: Eugene Lamskoy +Date: Sat, 18 Dec 2021 13:11:49 +0200 +Subject: [PATCH 2/2] Duplicate symbol definition removed + +--- + src/config.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/config.c b/src/config.c +index 71fe4f4..b92494c 100644 +--- a/src/config.c ++++ b/src/config.c +@@ -13,7 +13,6 @@ s_fidoconfig *config; + char *logFileName=NULL; + char *fidoConfigFile=NULL; + int fidocfg_in_env=0; +-char *versionStr; + + void Usage() + { diff --git a/scripts/binkd.sh b/scripts/binkd.sh new file mode 100644 index 0000000..a14bcce --- /dev/null +++ b/scripts/binkd.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash + +# shellcheck disable=SC1091 +source "${ROOTDIR}/scripts/binkd_vars.sh" +source "${ROOTDIR}/scripts/helpers/git.sh" + +function binkd_build() { + local configure_params=$* + + echo "* Starting building binkd..." + echo "* Additional configure parameters: ${configure_params}" + + git_source "binkd" "${_BINKD_GIT}" + + if ! cd "${_BINKD_SOURCE_DIR}"; then + echo "! Failed to change directory to '${_BINKD_SOURCE_DIR}'!" + exit 1 + fi + + cp mkfls/unix/* . + + # shellcheck disable=SC2086 + if ! ./configure ${_BINKD_CONFIGURE_PARAMS}; then + echo "! Failed to configure binkd sources!" + exit 1 + fi + + if ! make; then + echo "! Failed to compile binkd!" + exit 1 + fi + + if ! make install; then + echo "! Failed to install binkd!" + exit 1 + fi + + echo "* binkd installed." +} + +function binkd_configure() { + echo "* Configuring binkd..." + + mkdir -p "${_DATA_ROOT}"/{localinb,logs,protinb,tempinb} + + cat >"${_BINKD_CONFIG_FILE}" <"${ROOTDIR}/.config" + echo "export UPLINK_FTN=${UPLINK_FTN}" >>"${ROOTDIR}/.config" + echo "export UPLINK_NAME=${UPLINK_NAME}" >>"${ROOTDIR}/.config" + echo "export REAL_NAME=${REAL_NAME}" >>"${ROOTDIR}/.config" + echo "export FTN_ADDR=${FTN_ADDR}" >>"${ROOTDIR}/.config" + echo "export LOCATION=${LOCATION}" >>"${ROOTDIR}/.config" + echo "export MACHINE_NAME=${MACHINE_NAME}" >>"${ROOTDIR}/.config" + echo "export PASSWORD=${PASSWORD}" >>"${ROOTDIR}/.config" + echo "export AREAFIX_PASSWORD=${AREAFIX_PASSWORD}" >>"${ROOTDIR}/.config" + echo "export FILEFIX_PASSWORD=${FILEFIX_PASSWORD}" >>"${ROOTDIR}/.config" + +} + +function getresponse() { + stty raw + _RESP=$(dd bs=1 count=1 2>/dev/null) + export _RESP + stty cooked +} diff --git a/scripts/golded.sh b/scripts/golded.sh new file mode 100644 index 0000000..4c3b85f --- /dev/null +++ b/scripts/golded.sh @@ -0,0 +1,163 @@ +#!/usr/bin/env bash + +_GOLDED_BIN_DIR="${ROOTDIR}/dist/golded" +_GOLDED_GIT="https://github.com/golded-plus/golded-plus" + +function golded_build() { + echo "* Building golded+..." + + git_source "golded" "${_GOLDED_GIT}" + + cp "golded3/mygolded.__h" "golded3/mygolded.h" + + iconv -c -f cp866 -t utf8 docs/rusfaq.txt | sed 2s/cp866/utf-8/ >docs/rusfaq.utf8 + iconv -c -f cp866 -t utf8 docs/notework.rus | sed 2s/cp866/utf-8/ >docs/notework_rus.utf8 + iconv -c -f cp866 -t koi8-r docs/rusfaq.txt | sed 2s/cp866/koi8/ >docs/rusfaq.koi8 + iconv -c -f cp866 -t koi8-r docs/notework.rus | sed 2s/cp866/koi8/ >docs/notework_rus.koi8 + + cd cfgs/config || ( + echo "! Failed to cd to configs directory!" + exit 1 + ) + + for i in *.ru?; do + iconv -c -f cp866 -t koi8-r ${i} | sed 2s/cp866/koi8/ >${i}.koi8 + iconv -c -f cp866 -t utf-8 ${i} | sed 2s/cp866/utf-8/ >${i}.utf8 + done + iconv -c -f cp866 -t koi8-r aliasru.cfg | sed 2s/cp866/koi8/ >aliasru.koi8 + iconv -c -f cp866 -t utf-8 aliasru.cfg | sed 2s/cp866/utf-8/ >aliasru.utf8 + + cd ../template || ( + echo "! Failed to cd to templates directory!" + exit 1 + ) + + iconv -c -f cp866 -t koi8-r rusCP866.tpl | sed 2s/cp866/koi8/ >rusKOI8.tpl + iconv -c -f cp866 -t utf-8 rusCP866.tpl | sed 2s/cp866/utf-8/ >rusUTF8.tpl + + cd ../.. || ( + echo "! Failed to cd to sources directory!" + exit 1 + ) + + make WIDE_NCURSES=0 USE_NCURSES=1 KOI8=1 + + mkdir -p "${_GOLDED_BIN_DIR}/share/goldedplus"/{docs,charset,colorset,config,template} + install -d "${_GOLDED_BIN_DIR}/bin" + install -m 755 bin/rddtlnx "${_GOLDED_BIN_DIR}/bin/rddt" + install -m 755 bin/gnlnx "${_GOLDED_BIN_DIR}/bin/goldnode" + install -m 755 bin/gedlnx "${_GOLDED_BIN_DIR}/bin/gedlnx" + install -m 755 ../golded "${_GOLDED_BIN_DIR}/bin/golded" + patchelf --set-rpath /usr/lib/ncurses-golded/lib "${_GOLDED_BIN_DIR}/bin/gedlnx" + install -d "${_GOLDED_BIN_DIR}/man/man1" + install -m 644 docs/*.1 "${_GOLDED_BIN_DIR}/man/man1/" + install -m 644 etc/gecolor.conf "${_GOLDED_BIN_DIR}/share/goldedplus/colorset/gedcolor.cfg" + install -m 644 cfgs/config/* "${_GOLDED_BIN_DIR}/share/goldedplus/config" + install -m 644 cfgs/template/* "${_GOLDED_BIN_DIR}/share/goldedplus/template" + install -m 644 cfgs/charset/* "${_GOLDED_BIN_DIR}/share/goldedplus/charset" + install -m 644 cfgs/colorset/* "${_GOLDED_BIN_DIR}/share/goldedplus/colorset" + install -m 644 docs/*.utf8 "${_GOLDED_BIN_DIR}/share/goldedplus/docs" + install -m 644 docs/*.koi8 "${_GOLDED_BIN_DIR}/share/goldedplus/docs" + install -m 644 docs/{tips,linux,notework}.txt "${_GOLDED_BIN_DIR}/share/goldedplus/docs" +} + +function golded_configure() { + echo "* Configuring golded..." + + mkdir -p "${_CONFIG_ROOT}/golded" + + cat >"${_CONFIG_ROOT}/golded/golded.cfg" < /dev/null 2>&1 & +DispHdrLocation Yes +MsgListHeader 1 +KeybExt Yes +QuoteCtrl No +Include ${_GOLDED_BIN_DIR}/share/goldedplus/config/aliasru.koi8 +EOF +} + +function golded_start() { + echo "* Starting golded+..." + luit -encoding ru_RU.KOI8-R "${_GOLDED_BIN_DIR}"/bin/gedlnx -c"${_CONFIG_ROOT}/golded/golded.cfg" +} diff --git a/scripts/help.sh b/scripts/help.sh new file mode 100644 index 0000000..7db408c --- /dev/null +++ b/scripts/help.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +function help_show() { + echo "FidoIP control script." + echo "Copyright (c) 2022, Stanislav N. aka pztrn." + echo "" + echo "Building:" + echo "" + echo -e "\tbuild\t\t\t\tBuild everything with default parameters." + echo -e "\tbuild_binkd [configure_params]\tBuild binkd. Pass additional configure parameters" + echo -e "\t\t\t\t\tfor ./configure script." + echo -e "\tbuild_golded\t\t\tBuild golded+ editor." + echo -e "\tbuild_husky [component]\t\tBuild husky. Pass component name (only one) to build only" + echo -e "\t\t\t\t\tthat component (e.g. \"areafix\")." + echo -e "\tconfigure\t\t\tConfigure everything. Will overwrite any modifications made to generated" + echo -e "\t\t\t\t\tconfiguration files." + echo -e "\tsetup\t\t\t\tBuild and configure everything. Will overwrite any modifications made to" + echo -e "\t\t\t\t\tgenerated configuration files." + echo -e "\tsync\t\t\t\tSync with remote node. Use this command if you're a point." +} diff --git a/scripts/helpers/git.sh b/scripts/helpers/git.sh new file mode 100644 index 0000000..fe1f470 --- /dev/null +++ b/scripts/helpers/git.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +function git_source() { + local source_dir_name=$1 + local source_dir="${ROOTDIR}/src/${source_dir_name}" + local remote_repo=$2 + + if [ ! -d "${source_dir}" ]; then + echo "* Creating source directory '${source_dir_name}'..." + if ! mkdir -p "${source_dir}"; then + echo "! Failed to create '${source_dir_name}'!" + exit 1 + fi + fi + + if ! cd "${source_dir}"; then + echo "! Failed to change current directory to '${source_dir}'!" + exit 1 + fi + + if [ ! -d ".git" ]; then + echo "* Getting sources in '${source_dir_name}'..." + if ! git clone "${remote_repo}" .; then + echo "! Failed to get sources in '${source_dir_name}'!" + exit 1 + fi + else + echo "* Updating sources in '${source_dir_name}'..." + if ! git pull; then + echo "! Failed to update sources in '${source_dir_name}'!" + fi + fi +} diff --git a/scripts/husky_build.sh b/scripts/husky_build.sh new file mode 100644 index 0000000..d1cd78f --- /dev/null +++ b/scripts/husky_build.sh @@ -0,0 +1,404 @@ +#!/usr/bin/env bash + +# shellcheck disable=SC1091 +source "${ROOTDIR}/scripts/husky_vars.sh" +source "${ROOTDIR}/scripts/helpers/git.sh" + +function husky_build() { + local component=$1 + echo "* Building husky..." + + # User might (re)build only one component. + if [ "${component}" != "" ]; then + echo "!!! Building only '${component}'!" + + local funcname="husky_build_${component}" + ${funcname} + + exit 0 + fi + + # Build sequence was taken from husky-git package from Arch Linux AUR. + husky_build_huskylib + husky_build_smapi + husky_build_fidoconf + husky_build_areafix + husky_build_hptzip + husky_build_hpt + husky_build_areastat + husky_build_hptsqfix + husky_build_htick + husky_build_hptkill + husky_build_nltools + husky_build_sqpack + husky_build_bsopack +} + +function husky_build_areafix() { + echo "* Building husky's areafix..." + + _husky_build_common_start "areafix" "${_HUSKY_AREAFIX_GIT}" + + rm fidoconf huskylib smapi &>/dev/null + ln -s ../fidoconf/fidoconf fidoconf + ln -s ../huskylib/huskylib huskylib + ln -s ../smapi/smapi smapi + + rm -rf build &>/dev/null + + if ! cmake -Bbuild \ + -DBUILD_SHARED_LIBS=OFF \ + -Dhusky_LIB="${ROOTDIR}/dist/husky/lib/libhusky.a" \ + -Dsmapi_LIB="${ROOTDIR}/dist/husky/lib/libsmapi.a" \ + -Dfidoconfig_LIB="${ROOTDIR}/dist/husky/lib/libfidoconfig.a" \ + -DCMAKE_INSTALL_PREFIX:PATH="${_HUSKY_BIN_DIR}"; then + echo "! Failed to configure areafix!" + exit 1 + fi + + _husky_build_common_end "areafix" +} + +function husky_build_areastat() { + echo "* Building husky's areastat..." + + _husky_build_common_start "areastat" "${_HUSKY_AREASTAT_GIT}" + + rm huskylib smapi &>/dev/null + ln -s ../huskylib/huskylib huskylib + ln -s ../smapi/smapi smapi + + rm -rf build &>/dev/null + + # areastat's cvsdate.h placed in different place. + mv cvsdate.h h/cvsdate.h + + if ! cmake -Bbuild \ + -DBUILD_SHARED_LIBS=OFF \ + -Dhusky_LIB="${ROOTDIR}/dist/husky/lib/libhusky.a" \ + -Dsmapi_LIB="${ROOTDIR}/dist/husky/lib/libsmapi.a" \ + -DCMAKE_INSTALL_PREFIX:PATH="${_HUSKY_BIN_DIR}"; then + echo "! Failed to configure areastat!" + exit 1 + fi + + _husky_build_common_end "areastat" +} + +function husky_build_bsopack() { + echo "* Building husky's bsopack..." + + _husky_build_common_start "bsopack" "${_HUSKY_BSOPACK_GIT}" + + rm fidoconf huskylib smapi &>/dev/null + ln -s ../fidoconf/fidoconf fidoconf + ln -s ../huskylib/huskylib huskylib + ln -s ../smapi/smapi smapi + + rm -rf build &>/dev/null + + # bsopack requires patch to work with cmake. + git apply <"${ROOTDIR}/patches/bsopack.patch" + + # bsopack's cvsdate.h placed in different place. + #mv cvsdate.h h/cvsdate.h + + if ! cmake -Bbuild \ + -DBUILD_SHARED_LIBS=OFF \ + -Dfidoconfig_LIB="${ROOTDIR}/dist/husky/lib/libfidoconfig.a" \ + -Dhusky_LIB="${ROOTDIR}/dist/husky/lib/libhusky.a" \ + -Dsmapi_LIB="${ROOTDIR}/dist/husky/lib/libsmapi.a" \ + -DCMAKE_INSTALL_PREFIX:PATH="${_HUSKY_BIN_DIR}"; then + echo "! Failed to configure bsopack!" + exit 1 + fi + + _husky_build_common_end "bsopack" +} + +function husky_build_fidoconf() { + echo "* Building husky's fidoconf..." + + _husky_build_common_start "fidoconf" "${_HUSKY_FIDOCONF_GIT}" + + rm huskylib smapi &>/dev/null + ln -s ../huskylib/huskylib huskylib + ln -s ../smapi/smapi smapi + + rm -rf build &>/dev/null + + if ! cmake -Bbuild \ + -DBUILD_SHARED_LIBS=OFF \ + -Dhusky_LIB="${ROOTDIR}/dist/husky/lib/libhusky.a" \ + -Dsmapi_LIB="${ROOTDIR}/dist/husky/lib/libsmapi.a" \ + -DCMAKE_INSTALL_PREFIX:PATH="${_HUSKY_BIN_DIR}"; then + echo "! Failed to configure fidoconf!" + exit 1 + fi + + _husky_build_common_end "fidoconf" +} + +function husky_build_hpt() { + echo "* Building husky's hpt..." + + _husky_build_common_start "hpt" "${_HUSKY_HPT_GIT}" + + rm areafix fidoconf hptzip huskylib smapi &>/dev/null + ln -s ../areafix/areafix areafix + ln -s ../fidoconf/fidoconf fidoconf + ln -s ../hptzip/hptzip hptzip + ln -s ../huskylib/huskylib huskylib + ln -s ../smapi/smapi smapi + + rm -rf build &>/dev/null + + if ! cmake -Bbuild \ + -DBUILD_SHARED_LIBS=OFF \ + -Dareafix_LIB="${ROOTDIR}/dist/husky/lib/libareafix.a" \ + -Dfidoconfig_LIB="${ROOTDIR}/dist/husky/lib/libfidoconfig.a" \ + -Dhptzip_LIB="${ROOTDIR}/dist/husky/lib/libhptzip.a" \ + -Dhusky_LIB="${ROOTDIR}/dist/husky/lib/libhusky.a" \ + -Dsmapi_LIB="${ROOTDIR}/dist/husky/lib/libsmapi.a" \ + -DCMAKE_INSTALL_PREFIX:PATH="${_HUSKY_BIN_DIR}"; then + echo "! Failed to configure hpt!" + exit 1 + fi + + _husky_build_common_end "hpt" +} + +function husky_build_hptkill() { + echo "* Building husky's hptkill..." + + _husky_build_common_start "hptkill" "${_HUSKY_HPTKILL_GIT}" + + rm fidoconf huskylib smapi &>/dev/null + ln -s ../fidoconf/fidoconf fidoconf + ln -s ../huskylib/huskylib huskylib + ln -s ../smapi/smapi smapi + + rm -rf build &>/dev/null + + if ! cmake -Bbuild \ + -DBUILD_SHARED_LIBS=OFF \ + -Dfidoconfig_LIB="${ROOTDIR}/dist/husky/lib/libfidoconfig.a" \ + -Dhusky_LIB="${ROOTDIR}/dist/husky/lib/libhusky.a" \ + -Dsmapi_LIB="${ROOTDIR}/dist/husky/lib/libsmapi.a" \ + -DCMAKE_INSTALL_PREFIX:PATH="${_HUSKY_BIN_DIR}"; then + echo "! Failed to configure hptkill!" + exit 1 + fi + + _husky_build_common_end "hptkill" +} + +function husky_build_hptsqfix() { + echo "* Building husky's hptsqfix..." + + _husky_build_common_start "hptsqfix" "${_HUSKY_HPTSQFIX_GIT}" + + rm fidoconf huskylib smapi &>/dev/null + ln -s ../fidoconf/fidoconf fidoconf + ln -s ../huskylib/huskylib huskylib + ln -s ../smapi/smapi smapi + + rm -rf build &>/dev/null + + # hptsqfix's cvsdate.h placed in different place. + mv cvsdate.h h/cvsdate.h + + if ! cmake -Bbuild \ + -DBUILD_SHARED_LIBS=OFF \ + -Dfidoconfig_LIB="${ROOTDIR}/dist/husky/lib/libfidoconfig.a" \ + -Dhusky_LIB="${ROOTDIR}/dist/husky/lib/libhusky.a" \ + -Dsmapi_LIB="${ROOTDIR}/dist/husky/lib/libsmapi.a" \ + -DCMAKE_INSTALL_PREFIX:PATH="${_HUSKY_BIN_DIR}"; then + echo "! Failed to configure hptsqfix!" + exit 1 + fi + + _husky_build_common_end "hptsqfix" +} + +function husky_build_hptzip() { + echo "* Building husky's hptzip..." + + _husky_build_common_start "hptzip" "${_HUSKY_HPTZIP_GIT}" + + rm huskylib &>/dev/null + ln -s ../huskylib/huskylib huskylib + + rm -rf build &>/dev/null + + if ! cmake -Bbuild \ + -DBUILD_SHARED_LIBS=OFF \ + -Dhusky_LIB="${ROOTDIR}/dist/husky/lib/libhusky.a" \ + -DCMAKE_INSTALL_PREFIX:PATH="${_HUSKY_BIN_DIR}"; then + echo "! Failed to configure hptzip!" + exit 1 + fi + + _husky_build_common_end "hptzip" +} + +function husky_build_htick() { + echo "* Building husky's htick..." + + _husky_build_common_start "htick" "${_HUSKY_HTICK_GIT}" + + rm areafix fidoconf hptzip huskylib smapi &>/dev/null + ln -s ../areafix/areafix areafix + ln -s ../fidoconf/fidoconf fidoconf + ln -s ../hptzip/hptzip hptzip + ln -s ../huskylib/huskylib huskylib + ln -s ../smapi/smapi smapi + + rm -rf build &>/dev/null + + if ! cmake -Bbuild \ + -DBUILD_SHARED_LIBS=OFF \ + -Dareafix_LIB="${ROOTDIR}/dist/husky/lib/libareafix.a" \ + -Dfidoconfig_LIB="${ROOTDIR}/dist/husky/lib/libfidoconfig.a" \ + -Dhptzip_LIB="${ROOTDIR}/dist/husky/lib/libhptzip.a" \ + -Dhusky_LIB="${ROOTDIR}/dist/husky/lib/libhusky.a" \ + -Dsmapi_LIB="${ROOTDIR}/dist/husky/lib/libsmapi.a" \ + -DCMAKE_INSTALL_PREFIX:PATH="${_HUSKY_BIN_DIR}"; then + echo "! Failed to configure htick!" + exit 1 + fi + + _husky_build_common_end "htick" +} + +function husky_build_huskylib() { + echo "* Building husky's huskylib..." + + _husky_build_common_start "huskylib" "${_HUSKY_HUSKYLIB_GIT}" + + if ! cmake \ + -Bbuild \ + -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_INSTALL_PREFIX:PATH="${_HUSKY_BIN_DIR}"; then + echo "! Failed to configure huskylib!" + exit 1 + fi + + _husky_build_common_end "huskylib" +} + +function husky_build_nltools() { + echo "* Building husky's nltools..." + + _husky_build_common_start "nltools" "${_HUSKY_NLTOOLS_GIT}" + + rm fidoconf hptzip huskylib smapi &>/dev/null + ln -s ../fidoconf/fidoconf fidoconf + ln -s ../hptzip/hptzip hptzip + ln -s ../huskylib/huskylib huskylib + ln -s ../smapi/smapi smapi + + rm -rf build &>/dev/null + + # nltools's cvsdate.h placed in different place. + mv cvsdate.h h/cvsdate.h + + if ! cmake -Bbuild \ + -DBUILD_SHARED_LIBS=OFF \ + -Dfidoconfig_LIB="${ROOTDIR}/dist/husky/lib/libfidoconfig.a" \ + -Dhptzip_LIB="${ROOTDIR}/dist/husky/lib/libhptzip.a" \ + -Dhusky_LIB="${ROOTDIR}/dist/husky/lib/libhusky.a" \ + -Dsmapi_LIB="${ROOTDIR}/dist/husky/lib/libsmapi.a" \ + -DCMAKE_INSTALL_PREFIX:PATH="${_HUSKY_BIN_DIR}"; then + echo "! Failed to configure nltools!" + exit 1 + fi + + _husky_build_common_end "nltools" +} + +function husky_build_smapi() { + echo "* Building husky's smapi..." + + _husky_build_common_start "smapi" "${_HUSKY_SMAPI_GIT}" + + rm huskylib &>/dev/null + ln -s ../huskylib/huskylib huskylib + + rm -rf build &>/dev/null + + if ! cmake \ + -Bbuild \ + -DBUILD_SHARED_LIBS=OFF \ + -Dhusky_LIB="${ROOTDIR}/dist/husky/lib/libhusky.a" \ + -DCMAKE_INSTALL_PREFIX:PATH="${_HUSKY_BIN_DIR}"; then + echo "! Failed to configure smapi!" + exit 1 + fi + + _husky_build_common_end "smapi" +} + +function husky_build_sqpack() { + echo "* Building husky's sqpack..." + + _husky_build_common_start "sqpack" "${_HUSKY_SQPACK_GIT}" + + rm fidoconf huskylib smapi &>/dev/null + ln -s ../fidoconf/fidoconf fidoconf + ln -s ../huskylib/huskylib huskylib + ln -s ../smapi/smapi smapi + + rm -rf build &>/dev/null + + if ! cmake -Bbuild \ + -DBUILD_SHARED_LIBS=OFF \ + -Dfidoconfig_LIB="${ROOTDIR}/dist/husky/lib/libfidoconfig.a" \ + -Dhusky_LIB="${ROOTDIR}/dist/husky/lib/libhusky.a" \ + -Dsmapi_LIB="${ROOTDIR}/dist/husky/lib/libsmapi.a" \ + -DCMAKE_INSTALL_PREFIX:PATH="${_HUSKY_BIN_DIR}"; then + echo "! Failed to configure sqpack!" + exit 1 + fi + + _husky_build_common_end "sqpack" +} + +function _husky_build_common_end() { + local name=$1 + + if ! cmake --build build; then + echo "! Failed to build husky's ${name}!" + exit 1 + fi + + if ! cd build; then + echo "! Failed to change directory to build when trying to install ${name}!" + exit 1 + fi + + if ! make install; then + echo "! Failed to install husky's ${name}!" + exit 1 + fi +} + +function _husky_build_common_start() { + local name=$1 + local git_repo=$2 + + git_source "husky/${name}" "${git_repo}" + + if ! cd "${ROOTDIR}/src/husky/${name}"; then + echo "! Failed to change directory to husky's ${name} sources!" + exit 1 + fi + + _husky_generate_version +} + +function _husky_generate_version() { + echo "* Generating version file..." + echo "char cvs_date[]=\"$(date +'%Y%m%d')-git\";" >"cvsdate.h" + echo "* Version file: '$(cat cvsdate.h)'" +} diff --git a/scripts/husky_configure.sh b/scripts/husky_configure.sh new file mode 100644 index 0000000..d1465d7 --- /dev/null +++ b/scripts/husky_configure.sh @@ -0,0 +1,156 @@ +#!/usr/bin/env bash + +# shellcheck disable=SC1091 +source "${ROOTDIR}/scripts/husky_vars.sh" + +function husky_configure() { + echo "* Configuring husky..." + + mkdir -p "${_CONFIG_ROOT}/husky" + + mkdir -p "${_DATA_ROOT}"/{announce,badarea,carbonarea,dupearea,fileecho,flags,inbound,magic,msgbasedir} + mkdir -p "${_DATA_ROOT}"/{netmailarea,nodelist,outbound,protoinb,public,seq,tempinb,tempoutb,tics} + + cat >"${_CONFIG_ROOT}/husky/husky.cfg" <"${_CONFIG_ROOT}/husky/areas.cfg" <"${_CONFIG_ROOT}/husky/fileareas.cfg" <