New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add configure script #107
base: main
Are you sure you want to change the base?
Add configure script #107
Conversation
This works similar to the autohell.
This would only result in a diff being shown if configure rewrites conf-qmail.
for arg in $*; do | ||
case "${arg}" in | ||
--prefix=*) | ||
AUTO_QMAIL=$(echo "${arg}" | sed 's#^--prefix=##') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is AUTO_QMAIL=${arg#*=} to avoid instead of the more explicit AUTO_QMAIL=$(echo "${arg}" | sed 's#^--prefix=##')? This is a minor detail, I am fine with both styles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a bash extension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not look like so, but the sed version is also very clear and good.
${parameter#[word]}
Remove Smallest Prefix Pattern. The word shall be expanded to produce a pattern. The parameter expansion shall then result in parameter, with the smallest portion of the prefix matched by the pattern deleted. If present, word shall not begin with an unquoted '#'.
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02
AUTO_QMAIL=$(echo "${arg}" | sed 's#^--prefix=##') | ||
;; | ||
--help) | ||
echo "--prefix install prefix [/var/qmail]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we document --prefix
and not --prefix=dir
, we would have to support --prefix dir
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
|
||
AUTO_QMAIL=/var/qmail | ||
|
||
for arg in $*; do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest using for arg; do
which does the same as for arg in "$@"; do
, which helps in case any argument has a space in it, which is not expected anyway, so I am ok with for arg in $*; do
nontheless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good starting point: we have the configure here only so that the user can put its parameters onto the existing building toolchain, and thus without requiring to run ./configure
so that qmail gets built.
cat > conf-qmail << EOF | ||
${AUTO_QMAIL} | ||
|
||
This is the qmail home directory. It must be a local directory, not | ||
shared among machines. This is where qmail queues all mail messages. | ||
|
||
The queue (except for bounce message contents) is crashproof, if the | ||
filesystem guarantees that single-byte writes are atomic and that | ||
directory operations are synchronous. These guarantees are provided by | ||
fixed-block filesystems such as UFS and by journaling filesystems. Under | ||
Linux, make sure that all mail-handling filesystems are mounted with | ||
synchronous metadata. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to maintain these texts at two locatoins now. Maybe we can move them to some README or only make changes to the first line?
cat > conf-qmail << EOF | |
${AUTO_QMAIL} | |
This is the qmail home directory. It must be a local directory, not | |
shared among machines. This is where qmail queues all mail messages. | |
The queue (except for bounce message contents) is crashproof, if the | |
filesystem guarantees that single-byte writes are atomic and that | |
directory operations are synchronous. These guarantees are provided by | |
fixed-block filesystems such as UFS and by journaling filesystems. Under | |
Linux, make sure that all mail-handling filesystems are mounted with | |
synchronous metadata. | |
echo "${AUTO_QMAIL}" >conf-qmail.tmp | |
sed 1d conf-qmail >>conf-qmail.tmp | |
mv conf-qmail.tmp conf-qmail |
But with my change, this gets more done for each file, toward making complex ./configure script.
cat > make-makelib.sh << EOF | ||
echo 'main="\$1"; shift' | ||
echo 'rm -f "\$main"' | ||
echo '${AR} cr "\$main" \${1+"\$@"}' | ||
echo '${RANLIB} "\$main"' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, we have a script (./configure
) that generates a script (make-makelib.sh
) that is used to generate the script (make-makelib
) that generates the script (makelib
) that generates the library.
I will propose an extra branch for changing the make-makelib.sh to make AR and RANLIB configurable like CC and LD.
Note that this branch could have to be re-written for #35, which fits nicely to the model you have chosen for ./configure. |
Fixes #9