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

Fixed build script for BSD systems #1554

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ a.out
aclocal.m4
autom4te.cache
badinput
BSDmakefile
commit-stamp
compile
config.cache
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ See [Homebrew Tap for Universal Ctags](https://github.com/universal-ctags/homebr

## How to build and install ##

To build with Autotools, see `docs/autotools.rst` for more information.
(To build on GNU/Linux, Autotools is your choice.)
To build with Autotools (GNU/Linux, \*BSD, etc.), see `docs/autotools.rst` for more information.
To build on Windows, see `docs/windows.rst` for more information.
To build on OSX, see `docs/osx.rst` for more information.

Expand Down
26 changes: 25 additions & 1 deletion autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,31 @@ set -xe
type autoreconf || exit 1
type pkg-config || exit 1

ctags_files=`make -f makefiles/list-translator-input.mak --no-print-directory`
gen_bsdmakefile() {
set +xe
Copy link
Member

Choose a reason for hiding this comment

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

why changing those shell options? What is supposed to be the problem with e here, and why disabling x?

echo -e '.DONE:\n\t@echo "Please use GNU Make (gmake) to build this project"\n.DEFAULT:\n\t@echo "Please use GNU Make (gmake) to build this project"' > BSDmakefile
Copy link
Member

Choose a reason for hiding this comment

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

Can't you generate the 2 rules at once? like

.DONE .DEFAULT:
	@echo "Please use GNU Make (gmake) to build this project"

Copy link
Member

Choose a reason for hiding this comment

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

Also, would it be handy to forward the call to GNU Make automatically? If

.DONE .DEFAULT:
	@echo "Please use GNU Make (gmake) to build this project"
	make $@

is enough it seems handy. OK, maybe it's trickier because we'd like to forward some of the MAKEFLAGS but they are not all compatible between GNU and BSD make (e.g. I know NetBSD make adds a -J option GNU make doesn't understand to MAKEFLAGS when the user uses -j). Just a suggestion in case it wasn't already considered.

set -xe
}

is_bsd() {
UNAME=`uname`
if echo $UNAME | grep -i bsd >/dev/null; then
#return true
return 0
else
#return false
return 1
fi
Copy link
Member

Choose a reason for hiding this comment

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

Could be simplified a lot with

is_bsd() {
	uname | grep -i bsd >/dev/null
}

}

if is_bsd; then
MAKE="gmake"
gen_bsdmakefile
else
MAKE="make"
fi

ctags_files=`${MAKE} -f makefiles/list-translator-input.mak --no-print-directory`
misc/dist-test-cases > makefiles/test-cases.mak && \
if autoreconf -vfi; then
if type perl > /dev/null; then
Expand Down
2 changes: 1 addition & 1 deletion docs/autotools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Like most Autotools-based projects, you need to do::

$ ./autogen.sh
$ ./configure --prefix=/where/you/want # defaults to /usr/local
$ make
$ make # under BSD, GNU Make (`gmake`) should be used instead
$ make install # may require extra privileges depending on where to install

After installation the `ctags` executable will be in `$prefix/bin/`.
Expand Down