Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add configure script #107

wants to merge 3 commits into from

Conversation

DerDakon
Copy link
Member

Fixes #9

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=##')
Copy link

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.

Copy link
Member Author

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.

Copy link

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]"
Copy link

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?

Copy link
Member Author

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
Copy link

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.

Copy link

@josuah josuah left a 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.

Comment on lines +39 to +50
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.
Copy link

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?

Suggested change
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.

Comment on lines +53 to +57
cat > make-makelib.sh << EOF
echo 'main="\$1"; shift'
echo 'rm -f "\$main"'
echo '${AR} cr "\$main" \${1+"\$@"}'
echo '${RANLIB} "\$main"'
Copy link

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.

@josuah
Copy link

josuah commented Apr 11, 2020

Note that this branch could have to be re-written for #35, which fits nicely to the model you have chosen for ./configure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make it easy to configure (the build), build, and install
2 participants