Re: ##@!#@# gnu tools

2012-11-16 Thread Stefan Fritsch
On Thursday 15 November 2012, Reyk Floeter wrote:
> On Thu, Nov 15, 2012 at 5:11 PM, Marc Espie  wrote:
> > external people regularly ask "but why you don't want  to use
> > GNU/m4 GNU/make GNU/whatever ?"
> 
> External people seem to ask weird questions.
> 
> I just had to dig into autoconf/auto* because it seems to be a
> "must have" for a "portable" project. Yuck! 

That's all a matter of perspective. If you work on sane platforms like 
Linux and BSDs, you always think what do I need this autotools/libtool 
crap for, it would be much easier without them. But once you work on 
really weird platforms like AIX and do non-trivial tasks (like 
building shared libraries :-o ), autotools/libtool are sent from 
heaven and are really *so* much easier to use than what is available 
natively. I guess another example is Mac OS with its "universal 
binaries" that may contain both 32 and 64 bit, and both intel and 
powerpc code in the same file.

Also, for non-trivial projects, the advice "don't write portable make 
files, use a portable make instead" is very much true. Posix 
compatible make lacks even the most basic features.

Stefan



Re: ##@!#@# gnu tools

2012-11-16 Thread Alexandre Ratchov
On Thu, Nov 15, 2012 at 05:53:52PM +0100, Reyk Floeter wrote:
> On Thu, Nov 15, 2012 at 5:11 PM, Marc Espie  wrote:
> > external people regularly ask "but why you don't want  to use GNU/m4 
> > GNU/make
> > GNU/whatever ?"
> >
> 
> External people seem to ask weird questions.
> 
> I just had to dig into autoconf/auto* because it seems to be a "must
> have" for a "portable" project.

You'll loose less time if you write a nice and small ./configure
shell script by hand. I've such a script for few portable projects;
it respects the "gnu standards" and just works. Drop me a line if
you need examples/hints.

-- Alexandre



Re: ##@!#@# gnu tools

2012-11-15 Thread Matthias Kilian
On Thu, Nov 15, 2012 at 05:53:52PM +0100, Reyk Floeter wrote:
> External people seem to ask weird questions.
> 
> I just had to dig into autoconf/auto* because it seems to be a "must
> have" for a "portable" project.

Here's a simple configure replacement you could use for such projects:


#!/bin/sh

foo() {
ed -s "$0" <<- 'EOF'
/^echo/,/^foo$/d
w
q
EOF
exit
}

echo Just edit the Makefile.
foo
echo Please do not run this script again.
foo
echo "I told you, didn't I?"
foo
echo "STOP IT! Or I'll destroy myself."
foo
rm -f -- "$0"

Of course, the very first message is only necessary if there actually
*are* some system dependend things that can't be easily set by just
passing some variable assignments to make(1).

Ciao,
Kili

ps: while we are about annoyances -- I thought about a little project
(suitable for ports category "education" which would

- remove a random file when run without arguments.
- remove a few random files when run with -?.
- remove a lot of random files when run with --help.

This would be clearly documented in the man page of it.



Re: ##@!#@# gnu tools

2012-11-15 Thread Andres Perera
On Thu, Nov 15, 2012 at 1:13 PM, Marc Espie  wrote:
> On Thu, Nov 15, 2012 at 05:53:52PM +0100, Reyk Floeter wrote:
>> For all the GNU people, here is how a Makefile for hello.c should look like:
>> PROG= hello
>> NOMAN= yes
>> .include 
>>
>> Yes, you're supposed to provide a man page hello.1 and remove the NOMAN line 
>> :)
>
> Well, a portable Makefile for hello.c would be:
>
> .POSIX:
>
> OBJS = hello.o
>
> hello: $(OBJS)
> $(CC) -o $@ $(CFLAGS) $(OBJS)
>
>
>
> anything else (all, install, whatever) are just bonus.
> Surprisingly, .PHONY is not even standard...
>

a portable Makefile would be:

.POSIX:

hello:

because posix mandates built-in implicit rules for `.c:'

(why is pointing out these examples useful?)



Re: ##@!#@# gnu tools

2012-11-15 Thread Franco Fichtner
On Nov 15, 2012, at 5:53 PM, Reyk Floeter  wrote:

> On Thu, Nov 15, 2012 at 5:11 PM, Marc Espie  wrote:
>> external people regularly ask "but why you don't want  to use GNU/m4 GNU/make
>> GNU/whatever ?"
>> 
> 
> External people seem to ask weird questions.
> 
> I just had to dig into autoconf/auto* because it seems to be a "must
> have" for a "portable" project. Yuck! It is a reason why I don't
> understand and at the same time deeply respect our ports people: they
> have to mess with this stuff all the time!

The amount of hardcoding in Makefiles for GNU make is astounding given the
(flexible enough) design of GNU make. It's not as good as it could be, but
there are so many blunt tutorials and documentations available. They all fail
to use the tricks that have been used by BSDs for ages. It's always hardcoding
this, explicitly calling that...

It's not surprising that so many auto* and other magical make systems have been
build on top of that rocky foundation.

I've tried to work on a GNU compatible prog.mk and the like, but they are barely
in shape: https://github.com/fichtner/peak/blob/master/prog.mk

And then you still have to deal with differences in include syntax and bugs like
not handling paths in multiple layers of include files correctly.

> 
> For all the GNU people, here is how a Makefile for hello.c should look like:
> PROG= hello
> NOMAN= yes
> .include 
> 
> Yes, you're supposed to provide a man page hello.1 and remove the NOMAN line 
> :)
> 
> Reyk
> 
>> Well, latest one, turns out gnu-m4 has relly sloppy regexp handling.
>> Namely, stuff like
>> 
>> regexp(`n', `?')
>> *works* with gm4...
>> 
>> I know somewhat incredible...  our regexpes obviously will not like ? like
>> that, since it's not a normal character, and gnu regexp handling is such
>> a bluberring piece of code that it works... very reproducible, very so 
>> secure.
>> 
>> Reminds me of gnu libtool dropping silently stuff it doesn't understand...
>> 
>> oh wait, of course, *that* regexp is in the autoconf much leading to
>> gnu libtool.
>> 
>> Gee, what a surprise...



Re: ##@!#@# gnu tools

2012-11-15 Thread Marc Espie
On Thu, Nov 15, 2012 at 05:53:52PM +0100, Reyk Floeter wrote:
> For all the GNU people, here is how a Makefile for hello.c should look like:
> PROG= hello
> NOMAN= yes
> .include 
> 
> Yes, you're supposed to provide a man page hello.1 and remove the NOMAN line 
> :)

Well, a portable Makefile for hello.c would be:

.POSIX:

OBJS = hello.o

hello: $(OBJS)
$(CC) -o $@ $(CFLAGS) $(OBJS)



anything else (all, install, whatever) are just bonus.
Surprisingly, .PHONY is not even standard...



Re: ##@!#@# gnu tools

2012-11-15 Thread Mike Belopuhov
On Thu, Nov 15, 2012 at 5:53 PM, Reyk Floeter  wrote:
> On Thu, Nov 15, 2012 at 5:11 PM, Marc Espie  wrote:
>> external people regularly ask "but why you don't want  to use GNU/m4 GNU/make
>> GNU/whatever ?"
>>
>
> External people seem to ask weird questions.
>
> I just had to dig into autoconf/auto* because it seems to be a "must
> have" for a "portable" project. Yuck! It is a reason why I don't
> understand and at the same time deeply respect our ports people: they
> have to mess with this stuff all the time!
>
> For all the GNU people, here is how a Makefile for hello.c should look like:
> PROG= hello
> NOMAN= yes
> .include 
>
> Yes, you're supposed to provide a man page hello.1 and remove the NOMAN line 
> :)
>

not sure gnu people should include bsd.prog.mk (;



Re: ##@!#@# gnu tools

2012-11-15 Thread Reyk Floeter
On Thu, Nov 15, 2012 at 5:11 PM, Marc Espie  wrote:
> external people regularly ask "but why you don't want  to use GNU/m4 GNU/make
> GNU/whatever ?"
>

External people seem to ask weird questions.

I just had to dig into autoconf/auto* because it seems to be a "must
have" for a "portable" project. Yuck! It is a reason why I don't
understand and at the same time deeply respect our ports people: they
have to mess with this stuff all the time!

For all the GNU people, here is how a Makefile for hello.c should look like:
PROG= hello
NOMAN= yes
.include 

Yes, you're supposed to provide a man page hello.1 and remove the NOMAN line :)

Reyk

> Well, latest one, turns out gnu-m4 has relly sloppy regexp handling.
> Namely, stuff like
>
> regexp(`n', `?')
> *works* with gm4...
>
> I know somewhat incredible...  our regexpes obviously will not like ? like
> that, since it's not a normal character, and gnu regexp handling is such
> a bluberring piece of code that it works... very reproducible, very so secure.
>
> Reminds me of gnu libtool dropping silently stuff it doesn't understand...
>
> oh wait, of course, *that* regexp is in the autoconf much leading to
> gnu libtool.
>
> Gee, what a surprise...



##@!#@# gnu tools

2012-11-15 Thread Marc Espie
external people regularly ask "but why you don't want  to use GNU/m4 GNU/make
GNU/whatever ?"

Well, latest one, turns out gnu-m4 has relly sloppy regexp handling.
Namely, stuff like

regexp(`n', `?')
*works* with gm4...

I know somewhat incredible...  our regexpes obviously will not like ? like
that, since it's not a normal character, and gnu regexp handling is such
a bluberring piece of code that it works... very reproducible, very so secure.

Reminds me of gnu libtool dropping silently stuff it doesn't understand...

oh wait, of course, *that* regexp is in the autoconf much leading to 
gnu libtool.

Gee, what a surprise...