Skip to content

Commit

Permalink
?Macros.sh: --mingw regression fix, ctags ...
Browse files Browse the repository at this point in the history
	... much improved, plus typo fixes.

?`Macros.sh:
	`:%s/SUSUWU_PROCESS_MINGE/SUSUWU_PROCESS_MINGW/`: typo fix.
	?`SUSUWU_SUFFIX_SLASH()`, ?`SUSUWU_AFFIX_DOTSLASH()`: `:%s/$1/${1}/`: style/typo fix.
	?`SUSUWU_PRINT()`: style/comment improved.
	?`SUSUWU_PROCESS_MINGW()`, ?`SUSUWU_PROCESS_RELEASE_DEBUG()`, ?`SUSUWU_PROCESS_CLEAN_REBUILD()`: `:%s/ -o	/ -o /` (typo fix).
	?`SUSUWU_SETUP_CXX()`: quote `${CROSS_COMP}`.
	?`SUSUWU_PROCESS_INCLUDE()`, ?`SUSUWU_BUILD_OBJECTS()`: limit temp variables to `local` scope.
	?`SUSUWU_PROCESS_USRBIN()`: to prevent `cp: cannot create regular file '${USRBIN}/${OUTPUT}': Read-only file system`, prefer `USRBIN in ~/`.
	?`SUSUWU_BUILD_CTAGS()`: move down to rest of `SUSUWU_BUILD_*()` functions (since now uses `${C_SOURCE_PATH}` and `${CXX_SOURCE_PATH}`, unless you execute as `SUSUWU_BUILD_CTAGS "-flags..." "./path/"`).
	?`SUSUWU_TEST_OUTPUT()`: if ` --mingw` but "wine not found", `return 1`.
	`:%s/$?/$@/`, `:%s/STATUS=$@/STATUS=$?/`: typo fix ("Usage: ... $?" -> "Usage: ... ?@".)

?`build.sh`:
	?`SUSUWU_BUILD_CTAGS`:
		Move down to rest of `SUSUWU_BUILD_*` calls.
		Now produces `./tags` (which `ex`, `vi`, `vim` can use.)
		Comment how to use this.
	?`SUSUWU_PROCESS_MINGW`: comment how to use this.

?`README.md`:
	?`#Contributor-conventionsrules`:
		English improved,
		`:%s/Git/`git`/`,
		`:%s/[Source](#Source),[_C_/_C++_ source](#Cc-source)/`,
		+"[`sh` source](#Sh-source)".

Is followup to: f041ae9 (?`SUSUWU_[UN]INSTALL()`: implement. ?`Macros.sh`: more close to `make` protocols, improve codeflow).
Is progress to issues: #18 (support more tools), #21 (full `make` support).
  • Loading branch information
SwuduSusuwu committed Nov 20, 2024
1 parent f041ae9 commit 8cd8fa8
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 40 deletions.
88 changes: 55 additions & 33 deletions Macros.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/sh
SUSUWU_DIR_SUFFIX_SLASH() { #/* Usage: `OBJDIR=$(SUSUWU_ENSURE_DIR_SLASH "$OBJDIR") */
DIR=$1
DIR=${1}
if [ "${DIR}" = "${DIR%/}" ]; then #/* "%/" removes slash; if equal after this, original doesn't have '/'. */
DIR="${DIR}/" #/* if original doesn't have, append '/' */
fi
echo "${DIR}" #/* return with slash */
}
SUSUWU_DIR_AFFIX_DOTSLASH() { #/* Usage: `BINDIR=$(SUSUWU_ENSURE_DIR_SLASH "$BINDIR") */
DIR=$1
DIR=${1}
case "${DIR}" in
./*) #/* original has "./" */
;;
Expand Down Expand Up @@ -43,25 +43,20 @@ SUSUWU_SH_SUCCESS="[${SUSUWU_SH_GREEN}Success: ${SUSUWU_SH_WHITE}"
SUSUWU_SH_NOTICE="[${SUSUWU_SH_BLUE}Notice: ${SUSUWU_SH_WHITE}"
SUSUWU_SH_DEBUG="[${SUSUWU_SH_BLUE}Debug: ${SUSUWU_SH_WHITE}"
SUSUWU_SH_CLOSE_="${SUSUWU_SH_DEFAULT}]"
SUSUWU_PRINT() { #/* Usage: `SUSUWU_PRINT "${SUSUWU_SH_NOTICE}" "$0 launch" */
local LEVEL="${1}"; local x="${2}"
echo "${LEVEL}${x}${SUSUWU_SH_CLOSE_}" >&2 #/* fd=2 is `std::cerr`/`stderr` */
SUSUWU_PRINT() { #/* Usage: `SUSUWU_PRINT "${SUSUWU_SH_{ERROR,WARNING,INFO,SUCCESS,NOTICE,DEBUG}}" "message" */
local LEVEL="${1}";
local MESSAGE="${2}"
echo "${LEVEL}${MESSAGE}${SUSUWU_SH_CLOSE_}" >&2 #/* fd=2 is `std::cerr`/`stderr` */
}

SUSUWU_BUILD_CTAGS() {
if command -v ctags > /dev/null; then
ctags -R
fi
}

SUSUWU_PROCESS_MINGW() { #/* Usage: `SUSUWU_PROCESS_MINGW $?` */
SUSUWU_PROCESS_MINGW() { #/* Usage: `SUSUWU_PROCESS_MINGW $@` [This processes params passed to `${0}`.] */
CROSS_COMP=""
if [ "--mingw" = "${1}" -o "--mingw" = "${2}" ]; then
if [ "--mingw" = "${1}" -o "--mingw" = "${2}" ]; then
CROSS_COMP=" --mingw"
fi
}
SUSUWU_SETUP_CXX() { #/* Usage: ... [SUSUWU_PROCESS_MINGE $?] SUSUWU_SETUP_CXX [SUSUWU_PROCESS_RELEASE_DEBUG $?] SUSUWU_SETUP_BUILD_FLAGS SUSUWU_SETUP_BINDIR "" SUSUWU_SETUP_OBJDIR "" SUSUWU_SETUP_OUTPUT "" [SUSUWU_PROCESS_CLEAN_REBUILD $?] [SUSUWU_PROCESS_INCLUDES ""] SUSUWU_BUILD_SOURCES ... */
if [ " --mingw" == ${CROSS_COMP} ]; then
SUSUWU_SETUP_CXX() { #/* Usage: ... [SUSUWU_PROCESS_MINGW $@] SUSUWU_SETUP_CXX [SUSUWU_PROCESS_RELEASE_DEBUG $@] SUSUWU_SETUP_BUILD_FLAGS SUSUWU_SETUP_BINDIR "" SUSUWU_SETUP_OBJDIR "" SUSUWU_SETUP_OUTPUT "" [SUSUWU_PROCESS_CLEAN_REBUILD $@] [SUSUWU_PROCESS_INCLUDES ""] SUSUWU_BUILD_SOURCES ... */
if [ " --mingw" = "${CROSS_COMP}" ]; then
LDFLAGS="${LDFLAGS} -static-libgcc -static-libstdc++"
if command -v x86_64-w64-mingw32-clang++ > /dev/null; then
CXX="x86_64-w64-mingw32-clang++"
Expand All @@ -73,7 +68,6 @@ SUSUWU_SETUP_CXX() { #/* Usage: ... [SUSUWU_PROCESS_MINGE $?] SUSUWU_SETUP_CXX [
SUSUWU_PRINT "${SUSUWU_SH_ERROR}" "\`x86_64-w64-mingw32-clang++ not found\`, \`x86_64-w64-mingw32-g++ not found\`. Do \`apt install llvm-mingw-w64\` or \`apt install mingw-w64\`."
exit 1
fi
return; #/* don't override `CXX`. */
elif command -v clang++ > /dev/null; then
CXX="clang++" #/* TODO: +` -Xclang -analyze -Xclang -analyzer-output=text` (got no extra outputs from this) */
USE_FSAN=true #/* [`-fsan*` supports `g++`/`clang++`](https://developers.redhat.com/blog/2021/05/05/memory-error-checking-in-c-and-c-comparing-sanitizers-and-valgrind#tldr) */
Expand Down Expand Up @@ -105,8 +99,8 @@ SUSUWU_SETUP_CXX() { #/* Usage: ... [SUSUWU_PROCESS_MINGE $?] SUSUWU_SETUP_CXX [
return 0
}

SUSUWU_PROCESS_RELEASE_DEBUG() { #/* Usage: `SUSUWU_PROCESS_RELEASE_DEBUG $?` */
if [ "--release" = "${1}" -o "--release" = "${2}" ]; then
SUSUWU_PROCESS_RELEASE_DEBUG() { #/* Usage: `SUSUWU_PROCESS_RELEASE_DEBUG $@` [This processes params passed to `${0}`.] */
if [ "--release" = "${1}" -o "--release" = "${2}" ]; then
SUSUWU_PRINT "${SUSUWU_SH_NOTICE}" "\`${0}${CROSS_COMP} --release\` does not support profilers/debuggers (use \`${0}${CROSS_COMP} --debug\` for this)."
CXXFLAGS="${CXXFLAGS} ${CXXFLAGS_RELEASE}"
else
Expand All @@ -122,7 +116,7 @@ SUSUWU_PROCESS_RELEASE_DEBUG() { #/* Usage: `SUSUWU_PROCESS_RELEASE_DEBUG $?` */
fi
fi
}
SUSUWU_SETUP_BUILD_FLAGS() { #/* Usage: ... [SUSUWU_PROCESS_MINGE $?] SUSUWU_SETUP_CXX [SUSUWU_PROCESS_RELEASE_DEBUG $?] SUSUWU_SETUP_BUILD_FLAGS SUSUWU_SETUP_BINDIR "" SUSUWU_SETUP_OBJDIR "" SUSUWU_SETUP_OUTPUT "" [SUSUWU_PROCESS_CLEAN_REBUILD $?] [SUSUWU_PROCESS_INCLUDES ""] SUSUWU_BUILD_SOURCES ... */
SUSUWU_SETUP_BUILD_FLAGS() { #/* Usage: ... [SUSUWU_PROCESS_MINGW $@] SUSUWU_SETUP_CXX [SUSUWU_PROCESS_RELEASE_DEBUG $@] SUSUWU_SETUP_BUILD_FLAGS SUSUWU_SETUP_BINDIR "" SUSUWU_SETUP_OBJDIR "" SUSUWU_SETUP_OUTPUT "" [SUSUWU_PROCESS_CLEAN_REBUILD $@] [SUSUWU_PROCESS_INCLUDES ""] SUSUWU_BUILD_SOURCES ... */
LDFLAGS="${LDFLAGS}"
CXXFLAGS="${CXXFLAGS} ${CXXFLAGS_ANALYSIS}"
CCFLAGS="${CCFLAGS} ${CXXFLAGS}"
Expand Down Expand Up @@ -180,19 +174,19 @@ SUSUWU_CLEAN_OUTPUT() { #/* Usage: `SUSUWU_REBUILD_OUTPUT "Reason to clean" */
SUSUWU_REBUILD_OUTPUT() { #/* Usage: `SUSUWU_REBUILD_OUTPUT "Reason to rebuild" */
SUSUWU_CLEAN_OUTPUT_IMPL "${1}" ", plus continue. [Use \`${0}${CROSS_COMP} --clean\` to remove plus exit.]"
}
SUSUWU_PROCESS_CLEAN_REBUILD() { #/* Usage: `SUSUWU_PROCESS_CLEAN_REBUILD $?` */
if [ "--clean" = "${1}" -o "--clean" = "${2}" ]; then
SUSUWU_PROCESS_CLEAN_REBUILD() { #/* Usage: `SUSUWU_PROCESS_CLEAN_REBUILD $@` [This processes params passed to `${0}`.] */
if [ "--clean" = "${1}" -o "--clean" = "${2}" ]; then
SUSUWU_CLEAN_OUTPUT "Was called with \`${0}${CROSS_COMP} --clean\`"
fi
if [ "--rebuild" = "${1}" -o "--rebuild" = "${2}" ]; then
if [ "--rebuild" = "${1}" -o "--rebuild" = "${2}" ]; then
SUSUWU_REBUILD_OUTPUT "Was called with \`${0}${CROSS_COMP} --rebuild\`"
fi
}

SUSUWU_PROCESS_INCLUDES() { #/* Usage: `SUSUWU_BUILD_SOURCES ${C_SOURCE_PATH}*.h ${CXX_SOURCE_PATH}*.hxx` */
for SOURCE in $@; do
OBJECT="${OBJDIR}$(basename ${SOURCE} .hxx).o" #/* `basename`'s second param removes suffix */
SRCCXX="$(dirname ${SOURCE})/$(basename ${SOURCE} .hxx).cxx" #/* `basename`'s second param removes suffix */
local SOURCE; for SOURCE in $@; do
local OBJECT="${OBJDIR}$(basename ${SOURCE} .hxx).o" #/* `basename`'s second param removes suffix */
local SRCCXX="$(dirname ${SOURCE})/$(basename ${SOURCE} .hxx).cxx" #/* `basename`'s second param removes suffix */
if [ ${OBJECT} -ot ${SOURCE} -a -e ${SOURCE} ]; then #/* `&& [ -e ${SOURCE} ]` is: skip unless `${SOURCE}` exists. */
SUSUWU_REBUILD_OUTPUT "\`${SOURCE}\` (which is a common \`#include\`) is newer than \`${OBJECT}\`"
break
Expand All @@ -201,21 +195,49 @@ SUSUWU_PROCESS_INCLUDES() { #/* Usage: `SUSUWU_BUILD_SOURCES ${C_SOURCE_PATH}*.h
fi
done
}
SUSUWU_BUILD_CTAGS() { #/* Usage: `SUSUWU_BUILD_CTAGS [-flags... --flags...] [SOURCE_DIR]...`. Return value: if `ctags` is called; `0`, if not; `1`. */
local STATUS=1
if command -v ctags > /dev/null; then
if [ -z ${1} ] || [ -z ${2} ]; then
SUSUWU_PRINT "${SUSUWU_SH_INFO}" "\`SUSUWU_BUILD_CTAGS()\` was called with less than 2 params; will default to \`SUSUWU_BUILD_CTAGS \"-R --languages=C++\" \"\${C_SOURCE_PATH}\" \"\${C_SOURCE_PATH}\"\` (paths: \"${C_SOURCE_PATH}\" \"${CXX_SOURCE_PATH}\")."
if [ -n "${C_SOURCE_PATH}" ]; then
ctags -R "${C_SOURCE_PATH}"
STATUS=0
fi
if [ -n "${CXX_SOURCE_PATH}" ]; then
ctags -R --languages=C++ --c++-kinds=+p --fields=+l --extras=+q ${CXX_SOURCE_PATH}
#ctags -R ${CXX_SOURCE_PATH}
STATUS=0
fi
else
local FLAGS=${1}
local SOURCE_PATH
shift 1 #/* `${@:3}` requires `/bin/bash`. `shift X` sets `$@` to `${X+1} ... ${N-1}`. */
local SOURCE_PATH; for SOURCE_PATH in $@; do
ctags "${FLAGS}" ${SOURCE_PATH}
STATUS=0
done
fi
else
SUSUWU_PRINT "${SUSUWU_SH_ERROR}" "\`ctags not found\`; do \`apt install ctags\` to use \`SUSUWU_BUILD_CTAGS\`."
fi
return ${STATUS};
}
SUSUWU_BUILD_OBJECTS() { #/* Usage: `SUSUWU_BUILD_SOURCES [${CC} || ${CXX}] [${CCFLAGS} || ${CXXFLAGS}] ".cxx" ${CXX_SOURCE_PATH}*.cxx [ optionalExtraPath/*.cxx ] [ ... ]*/
OLD_ARG_1=${1}
OLD_ARG_2=${2}
local OLD_ARG_1=${1}
local OLD_ARG_2=${2}
shift 2 #/* `${@:3}` requires `/bin/bash`. `shift X` sets `$@` to `${X+1} ... ${N-1}`. */
set -x
for SOURCE in $@; do
OBJECT="${OBJDIR}$(basename "${SOURCE}" "${OLD_ARG_2}").o" #/* `basename`'s second param removes suffix */
local SOURCE; for SOURCE in $@; do
local OBJECT="${OBJDIR}$(basename "${SOURCE}" "${OLD_ARG_2}").o" #/* `basename`'s second param removes suffix */
if [ ${OBJECT} -ot ${SOURCE} -o ! -s ${OBJECT} ] > /dev/null 2>&1; then
${OLD_ARG_1} -c "${SOURCE}" -o "${OBJECT}"
BUILDNEW=true
fi
OBJECTLIST="${OBJECTLIST} ${OBJECT}"
done
}
SUSUWU_BUILD_EXECUTABLE() { #/* Usage: ... [SUSUWU_PROCESS_MINGE $?] SUSUWU_SETUP_CXX [SUSUWU_PROCESS_RELEASE_DEBUG $?] SUSUWU_SETUP_BUILD_FLAGS SUSUWU_SETUP_BINDIR "" SUSUWU_SETUP_OBJDIR "" SUSUWU_SETUP_OUTPUT "" [SUSUWU_PROCESS_CLEAN_REBUILD $?] [SUSUWU_PROCESS_INCLUDES ""] SUSUWU_BUILD_OBJECTS() SUSUWU_BUILD_EXECUTABLE() ... */
SUSUWU_BUILD_EXECUTABLE() { #/* Usage: ... [SUSUWU_PROCESS_MINGW $@] SUSUWU_SETUP_CXX [SUSUWU_PROCESS_RELEASE_DEBUG $@] SUSUWU_SETUP_BUILD_FLAGS SUSUWU_SETUP_BINDIR "" SUSUWU_SETUP_OBJDIR "" SUSUWU_SETUP_OUTPUT "" [SUSUWU_PROCESS_CLEAN_REBUILD $@] [SUSUWU_PROCESS_INCLUDES ""] SUSUWU_BUILD_OBJECTS() SUSUWU_BUILD_EXECUTABLE() ... */
${BUILDNEW} && ${LD} ${LDFLAGS}${OBJECTLIST} -o "${BINDIR}${OUTPUT}"
STATUS=$?
set +x
Expand All @@ -239,7 +261,7 @@ SUSUWU_TEST_OUTPUT() {
wine ${BINDIR}${OUTPUT}
else
SUSUWU_PRINT "${SUSUWU_SH_INFO}" "\`wine not found\`. do \`apt install wine\`."
return 0
return 1
fi
fi
STATUS=$?
Expand Down Expand Up @@ -271,9 +293,9 @@ SUSUWU_PROCESS_USRBIN() { #/* Usage: `SUSUWU_USRBIN ["SUSUWU_[UN]INSTALL" [/usr/
fi
return 0
fi
for USRBIN in "/usr/bin" "/usr/local/bin" "$(realpath -q ~/../usr/bin)" "$(realpath -q ~/../usr/local/bin)" "$(realpath -q ~/../local/bin)" "$(realpath -q ~/.local/bin)"; do
for USRBIN in "$(realpath -q ~/.local/bin)" "$(realpath -q ~/../usr/bin)" "$(realpath -q ~/../usr/local/bin)" "$(realpath -q ~/../local/bin)" "/usr/bin" "/usr/local/bin"; do
if [ -d "${USRBIN}" ]; then
SUSUWU_PRINT "${SUSUWU_SH_NOTICE}" "\`${1}\` was not passed \`USRBIN\`. Autodetected as \`${USRBIN}\`."
SUSUWU_PRINT "${SUSUWU_SH_NOTICE}" "\`${1}\` was not passed \`USRBIN\`. Search has set \`USRBIN=\"${USRBIN}\"\`."
return 0
fi
done
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ Dual licenses: choose [_Creative Commons_](https://creativecommons.org/share-you
- [Purposes](#Purposes)
- [How to use this](#How-to-use-this)
- [Contributor conventions/rules](#Contributor-conventionsrules)
- [Git](#Git)
- [Source](#Source)
- [Good first issues](https://github.com/SwuduSusuwu/SubStack/contribute)
- [`git`](#Git)
- [`sh` source](#Sh-source)
- [_C_/_C++_ source](#Cc-source)
- [Good first issues to contribute to](https://github.com/SwuduSusuwu/SubStack/contribute)
- [Secure](https://github.com/SwuduSusuwu/SubStack/blob/trunk/SECURITY.md)

# Purposes
Expand Down Expand Up @@ -65,7 +66,11 @@ Do atomic commits: if you cannot `./build.sh` your commit if it is swapped (such
- if `git mv OldPath/ NewPath/`: `\`OldPath/.* -> NewPath/.*\``.

[Notice: Commit titles can omit backticks (``) if not enough room; the backticks just allow _GitHub_ to format code/paths.]
## Source
## `sh` source
Is as for _C++_, except that you act as if all functions/variables are macros (which use `CONSTANT_CASE`).
Specific to `sh` (but doesn't conflict with _C++_): variable access shall include "{}" (thus not `$1`, but `${1}`).
For temp variables, you affix `local` (thus not `for VALUE in LIST; do` but `local VALUE; for VALUE in LIST; do`).
## _C_/_C++_ source
Most of what [_Mozilla Org_'s (_Firefox_'s) style](https://firefox-source-docs.mozilla.org/code-quality/coding-style/coding_style_cpp.html) suggests is sound (you should follow this unless you have specific reasons not to).
Code rules (lots overlap with _Mozilla Org_'s):

Expand Down
5 changes: 2 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
. ./Macros.sh #/* SUSUWU_BUILD_CTAGS SUSUWU_BUILD_OBJECTS() SUSUWU_BUILD_EXECUTABLE() SUSUWU_INSTALL() SUSUWU_PRINT() SUSUWU_PROCESS_CLEAN_REBUILD() SUSUWU_PROCESS_MINGW() SUSUWU_PROCESS_RELEASE_DEBUG() SUSUWU_SETUP_BUILD_FLAGS() SUSUWU_SETUP_CXX() SUSUWU_SETUP_BINDIR() SUSUWU_SETUP_OBJDIR() SUSUWU_SETUP_OUTPUT() SUSUWU_SH_* SUSUWU_TEST_OUTPUT() SUSUWU_UNINSTALL() */
SUSUWU_PRINT "${SUSUWU_SH_NOTICE}" "Dual licenses: choose \"Creative Commons\" or \"Apache 2\" (allows all uses)."

SUSUWU_BUILD_CTAGS #/* Usage: `apt-get install ctags` */

CXXFLAGS_SPECIAL="" #/* You can put special flags from `build.sh` into this to use. */
CXXFLAGS_ANALYSIS="-Wall -Wno-unused -Wno-unused-function -Wextra -Wno-unused-parameter -Wno-ignored-qualifiers" #/*TODO: -`-Wno-*`, +`-Wpedantic`, +`-Werror` */
CXXFLAGS_RELEASE="-fomit-frame-pointer -DNDEBUG -O2" #/* without frame pointer (pointer used for stacktraces), without `assert(...)`/`SUSUWU_DEBUG(...)`/`SUSUWU_NOTICE(...)`, with optimization level 2 */
Expand All @@ -17,7 +15,7 @@ C_SOURCE_PATH="./c/"
CXX_SOURCE_PATH="./cxx/"


SUSUWU_PROCESS_MINGW $@ #/* Usage: `./build.sh --mingw` */
SUSUWU_PROCESS_MINGW $@ #/* Usage: `apt install mingw wine && ./build.sh --mingw`. [MinGW cross-builds to Windows.] */
SUSUWU_SETUP_CXX #/* Analogous to `make config` */
SUSUWU_PROCESS_RELEASE_DEBUG $@ #/* Usage: `./build.sh --debug` or `./build.sh --release` */

Expand All @@ -28,6 +26,7 @@ SUSUWU_PROCESS_CLEAN_REBUILD $@ #/* Usage: `./build.sh --clean` or `./build.sh -

SUSUWU_SETUP_BUILD_FLAGS #/* Analogous to `make config` */
SUSUWU_PROCESS_INCLUDES ${CXX_SOURCE_PATH}Class*.hxx ${CXX_SOURCE_PATH}Macros.hxx
SUSUWU_BUILD_CTAGS #/* Usage: `apt-get install ctags vim && vim -t tagToSearchFor` */
SUSUWU_BUILD_OBJECTS "${CC} ${CCFLAGS}" ".c" "${C_SOURCE_PATH}rfc6234/sha1.c" "${C_SOURCE_PATH}rfc6234/sha224-256.c" "${C_SOURCE_PATH}rfc6234/sha384-512.c"
SUSUWU_BUILD_OBJECTS "${CXX} ${CXXFLAGS}" ".cxx" "${CXX_SOURCE_PATH}*.cxx"
SUSUWU_BUILD_EXECUTABLE
Expand Down

1 comment on commit 8cd8fa8

@SwuduSusuwu
Copy link
Owner Author

@SwuduSusuwu SwuduSusuwu commented on 8cd8fa8 Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the commit message was not specific about how this fixes MinGW (which is activated with ./build.sh --mingw):
/bin/sh does not have == (as /bin/bash has), thus

-SUSUWU_SETUP_CXX() { #/* Usage: ... [SUSUWU_PROCESS_MINGE $?] SUSUWU_SETUP_CXX [SUSUWU_PROCESS_RELEASE_DEBUG $?] SUSUWU_SETUP_BUILD_FLAGS SUSUWU_SETUP_BINDIR "" SUSUWU_SETUP_OBJDIR "" SUSUWU_SETUP_OUTPUT "" [SUSUWU_PROCESS_CLEAN_REBUILD $?] [SUSUWU_PROCESS_INCLUDES ""] SUSUWU_BUILD_SOURCES ... */
-       if [ " --mingw" == ${CROSS_COMP} ]; then
+SUSUWU_SETUP_CXX() { #/* Usage: ... [SUSUWU_PROCESS_MINGW $@] SUSUWU_SETUP_CXX [SUSUWU_PROCESS_RELEASE_DEBUG $@] SUSUWU_SETUP_BUILD_FLAGS SUSUWU_SETUP_BINDIR "" SUSUWU_SETUP_OBJDIR "" SUSUWU_SETUP_OUTPUT "" [SUSUWU_PROCESS_CLEAN_REBUILD $@] [SUSUWU_PROCESS_INCLUDES ""] SUSUWU_BUILD_SOURCES ... */
+       if [ " --mingw" = "${CROSS_COMP}" ]; then

fixes the comparison to " --mingw".

Please sign in to comment.