From: Akira Yokosawa <akiyks@gmail.com>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: perfbook@vger.kernel.org, Akira Yokosawa <akiyks@gmail.com>
Subject: [GIT PULL -perfbook] Improve portability of build scripts
Date: Fri, 10 Mar 2023 23:06:56 +0900 [thread overview]
Message-ID: <21e1a397-c9aa-2100-527c-e29191a918c2@gmail.com> (raw)
Hi Paul,
As I mentioned a month ago or so, I've been working on improving
portability of building perfbook.
By portability, I did actual tests mostly under FreeBSD and light weight
alpine container images, not under macOS.
So I don't know if this enables native build for macOS, but here we are.
I don't expect any regression for existing build environments.
(Famous last words!)
Thanks, Akira
--
The following changes since commit 7876fdfc56dd679b41f68ca5507f1637de35bbb6:
defer/rcu: Include Butler Lampson RCU assessment (2023-02-28 13:30:47 -0800)
are available in the Git repository at:
https://github.com/akiyks/perfbook.git tags/for-paul-portable-build
for you to fetch changes up to f7592d2c93182397b032413d68fa139baae262fa:
FAQ-BUILD.txt: Remove /bin/bash from list of requirements (2023-03-10 20:15:12 +0900)
----------------------------------------------------------------
Improve portability of build scripts
Makefile and build scripts have assumed utility commands found
on GNU/Linux systems.
Past attempts to build perfbook under non-GNU/Linux hosts such as
macOS and FreeBSD failed due to differences in directory-tree
conventions and lack of command features specific to GNU variants.
Here is a list of non-portable conventions and features assumed
in the past:
- /usr/bin/perl in shebang
- date: syntax of options for format conversion
- sed: -e in front of regex can be omitted
- sed: "{" in to-be-replaced regex where repeat count is not
expected is interpreted as literal "{"
- sed: multi-line edit
- grep: -z option
* Changes made for better portability:
- #!/usr/bin/perl -> #!/usr/bin/env perl
- sed: always use -e in front of regex
- sed: escape literal "{" in to-be-replaced regexs
* Still need capable implementation of commands:
- date: format conversion
(needed in autodate.sh)
either GNU or BSD flavor works, busybox date can't do such conversion
- sed: multi-line edit
(needed in extractqqz.sh)
- FreeBSD's native sed lacks this feature
- grep: -z option
(for checking \cref{}{} which should be \crefrange{}{})
- busybox grep on alpine lacks this config
This check is moved from Makefile to cleverefcheck.sh and
skipped if an incapable grep is detected.
Necessary features of date and sed are now checked in the very beginning
of make runs. Manually running "make precheck" can give a verbose
result of the check.
For those who have a full featured command in a different name,
make/environment variables SED, DATE, or GREP can be used to specify
an alternative name or full path.
* Package/command removed from requirements:
- fig2ps
- which
- bash
** fig2ps
On most Linux and other UNIX-like distros, fig2ps is not provided as
a distro package.
fig2ps would be needed if LaTeX special strings (such as math expressions)
were used in FIG files. But it is not the case. Instead, fig2dev is
good enough for .fig --> .eps conversions.
fig2dev should be available for most distros as a package named
"fig2dev" or "transfig".
** which
It has become usual to be greeted with the
"which: command not found"
message on minimal installation of Linux distros, for example,
RHEL/CentOS/Fedora and Arch.
Instead, "command -v" is the portable way for testing command
existence since POSIX 2008/2013.
** /bin/bash
It turns out that existing build scripts work with variety of /bin/sh
choices including dash, bash, zsh, and even busybox sh.
The setting of "SHELL = /bin/bash" in Makefile is now dropped.
Tested under FreeBSD 13.1 and alpine.
----------------------------------------------------------------
Akira Yokosawa (15):
Use /usr/bin/env in shebang of perl scripts
extractqqz.sh: Allow alternative command name for 'sed'
Makefile: Use multiple '-e' flags for non-GNU sed compatibility
autodate.sh: Add code for BSD-flavor date command
autodate.sh: Allow alternative command name for 'date'
Makefile: Use portable egrep pattern (enclose '{' in '[]')
Makefile: Move CREFPAIR check into cleverefcheck.sh
FAQ-BUILD.txt: Add Q&A on building under non-GNU/Linux systems
Use fig2dev as fallback to fig2eps
Add precheck.sh
FAQ-BUILD: Mention precheck
Stop using 'which' command in bulid scripts
FAQ-BUILD.txt: Remove fig2ps from necessary packages
Makefile: Remove 'SHELL = /bin/bash'
FAQ-BUILD.txt: Remove /bin/bash from list of requirements
FAQ-BUILD.txt | 53 +++++++++++++++++++++++--
Makefile | 54 ++++++++++++-------------
a2ping-rule.mk | 2 +-
epstopdf-rule.mk | 2 +-
utilities/autodate.sh | 24 +++++++++---
utilities/checkfcv.pl | 2 +-
utilities/cleverefcheck.pl | 2 +-
utilities/cleverefcheck.sh | 23 +++++++++++
utilities/divideqqz.pl | 2 +-
utilities/extpagegroup.pl | 2 +-
utilities/extractqqz.sh | 17 ++++----
utilities/fcvextract.pl | 2 +-
utilities/gen_snippet_d.pl | 2 +-
utilities/mpostcheck.sh | 4 +-
utilities/precheck.sh | 98 ++++++++++++++++++++++++++++++++++++++++++++++
utilities/qqzreorder.pl | 2 +-
utilities/reorder_ltms.pl | 2 +-
utilities/verbboxcheck.pl | 2 +-
18 files changed, 238 insertions(+), 57 deletions(-)
create mode 100755 utilities/precheck.sh
next reply other threads:[~2023-03-10 14:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 14:06 Akira Yokosawa [this message]
2023-03-10 15:39 ` [GIT PULL -perfbook] Improve portability of build scripts Paul E. McKenney
2023-03-10 23:10 ` Akira Yokosawa
2023-03-11 1:27 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=21e1a397-c9aa-2100-527c-e29191a918c2@gmail.com \
--to=akiyks@gmail.com \
--cc=paulmck@kernel.org \
--cc=perfbook@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).