jschlatow / taskopen

Tool for taking notes and open urls with taskwarrior
GNU General Public License v2.0
364 stars 31 forks source link

Makefile contains bashism's, causes failure to install on Ubuntu 18.04 #111

Closed prakashsurya closed 6 years ago

prakashsurya commented 6 years ago

When trying to install this on Ubuntu 18.04, it failed:

$ sudo make DESTDIR=/opt/taskopen install
gzip -c doc/man/taskopen.1 > doc/man/taskopen.1.gz
gzip -c doc/man/taskopenrc.5 > doc/man/taskopenrc.5.gz
sed s',#PATH_EXT=.*,&\nPATH_EXT=/usr/local//share/taskopen/scripts,' taskopen > taskopen.pl
mkdir -p /opt/taskopen//usr/local//bin
install -m 0755 taskopen.pl /opt/taskopen//usr/local//bin/taskopen
mkdir -p /opt/taskopen//usr/local//share/man/{man1,man5}
install -m 0644 doc/man/taskopen.1.gz /opt/taskopen//usr/local//share/man/man1/
install: target '/opt/taskopen//usr/local//share/man/man1/' is not a directory: No such file or directory
Makefile:13: recipe for target 'install' failed
make: *** [install] Error 1

This appears to be due to the Makefile containing some bash specific syntax, and Ubuntu 18.04's /bin/sh using dash instead of bash:

$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 May  4 11:43 /bin/sh -> dash*

I was able to workaround this issue by explicitly using bash when running make:

$ sudo make SHELL=/bin/bash PREFIX=/opt/taskopen install
gzip -c doc/man/taskopen.1 > doc/man/taskopen.1.gz
gzip -c doc/man/taskopenrc.5 > doc/man/taskopenrc.5.gz
sed s',#PATH_EXT=.*,&\nPATH_EXT=/opt/taskopen/share/taskopen/scripts,' taskopen > taskopen.pl
mkdir -p //opt/taskopen/bin
install -m 0755 taskopen.pl //opt/taskopen/bin/taskopen
mkdir -p //opt/taskopen/share/man/{man1,man5}
install -m 0644 doc/man/taskopen.1.gz //opt/taskopen/share/man/man1/
install -m 0644 doc/man/taskopenrc.5.gz //opt/taskopen/share/man/man5/
mkdir -p //opt/taskopen/share/taskopen/doc/html
install -m 0644 doc/html/* //opt/taskopen/share/taskopen/doc/html
mkdir -p //opt/taskopen/share/taskopen/scripts
install -m 755 scripts/* //opt/taskopen/share/taskopen/scripts/

Since the default shell for make is /bin/sh, I think the bash-isms should either be removed from the Makefile, or the README should be updated such that it states that SHELL=/bin/bash should be specified.

With all that said, thanks for the awesome tool! :)

jschlatow commented 6 years ago

Thank you @prakashsurya