Re: [Tinycc-devel] out-of-tree builds are broken

2013-02-08 Thread Akim Demaille

Le 8 févr. 2013 à 11:08, Thomas Preud'homme  a écrit :

>> Creating config.mak and config.h
>> mkdir: tests/Makefile: Not a directory
>> ln: tests/tests2/Makefile: No such file or directory
>> 
>> These last two lines should that something has been broken.
> 
> Should be fixed.

It is.  Thanks!


___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] out-of-tree builds are broken

2013-02-08 Thread Akim Demaille
Something must have been changed in the way the out-of-tree
builds are handled.  This used to work.

$ git describe --always
7a477d7
$ mkdir -p _build/gcc48
$ cd _build/gcc48
$ ../../configure CC=gcc-mp-4.8
configure: WARNING: unrecognized option CC=gcc-mp-4.8
Binary  directory   /usr/local/bin
TinyCC directory/usr/local/lib/tcc
Library directory   /usr/local/lib
Include directory   /usr/local/include
Manual directory/usr/local/share/man
Info directory  /usr/local/share/info
Doc directory   /usr/local/share/doc/tcc
Target root prefix  
Source path  ../..
C compiler   gcc
Target OSDarwin
CPU  x86-64
Big Endian   no
gprof enabledno
cross compilers  no
use libgcc   no
Creating config.mak and config.h
mkdir: tests/Makefile: Not a directory
ln: tests/tests2/Makefile: No such file or directory

These last two lines should that something has been broken.



___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Call for testing

2013-01-14 Thread Akim Demaille

Le 14 janv. 2013 à 18:23, Thomas Preud'homme  a écrit :

> What do you think of the proposed fix? It works for me at least. It first 
> look 
> at the directory in which the symlink is to be done and strip entirely the 
> path if it's "./". Else, it will look like path/to/symlink and it will 
> replace 
> each subdirectory by .., as in your original patch.

yes, this is what I meant by "cleaning".

> At this stage you get the correct number of .. to go down from the directory 
> where a given symlink is to be created to the directory in which configure 
> was 
> called. You just need to add the relative path to the source root + the path 
> to the Makefile needing to be symlinked.

This part is expected to be correct in what I had submitted.
IIRC, only the "cleanup" part is needed, right?  You might
have intended to attach a patch for review :)


___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Call for testing

2013-01-14 Thread Akim Demaille

Le 14 janv. 2013 à 17:55, "Thomas Preud'homme"  a écrit :

> Hi Akim,

Hi Thomas,

If there were other messages for me, I might have missed them :(

> Can you explain me what is the purpose of second part of the sed command used 
> to create symlink to Makefile: s,[^/]*/,../,g

The thing is that "cp 1/2 3/4/" and "ln 1/2 3/4/" have nothing
in common: in the "ln" case, it is equivalent to "cd 3/4 && ln 1/2 .".
Absolute paths are resolved from the destination, not from the
current directory.  So if I mean to "ln 1/2 3/4/" in the way cp
does, I need to "ln ../../1/2 3/4/".

> I'm trying to build from tmp/tcc-builddir while the source are in tmp/tcc. 
> The 
> first part of the sed command correctly transform "../tcc/./" into ../tcc/ 
> but 
> then the second part change it into ../../
> 
> I suppose that was not the intended behavior but I don't see what was 
> expected.

This is the kind of things that Autoconf provides bullet proof :(
I don't know why there is the trailing "./", I guess it should
suffice to "cleanup" the directories first, i.e., removing things
like "./".
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] VPATH builds

2012-12-21 Thread Akim Demaille
(Sorry, I just noticed this window now, I really thought I had
already sent this message...)

hi all,

Le 20 déc. 2012 à 23:29, grischka  a écrit :

> Apropos VPATH, our new VPATH/out-of-tree build seems to have some
> problems:
>../tinycc/configure && make
> doesn't work.  Problems also with
>make install

I have installed fixes for these (included below FTR).

> and possibly with
>configure --enable-cross

I have not tried that yet.

> Akim?
> 
> Apropos problems, I've committed a new "tar" target (including some
> CRLF conversion) and also removed the hard-coded version string from
> build-tcc.bat.  That is two things less to worry about for release.

Well, again, there is an existing practice of "make dist",
I'd suggest using that name.  I find it bizarre that tcc
uses the GNU Build System conventions (configure && make
&& make install), but departs from it for make check and
make dist.


commit 9c9ca2032bc033792d748264e34e810e689598b5
Author: Akim Demaille 
Date:   Fri Dec 21 13:41:43 2012 +0100

configure: style changes

* configure (case $targetos): Improve readibility.
(case $cpu): New, to improve readability compare to if + test.

diff --git a/configure b/configure
index b4ac328..b440c5d 100755
--- a/configure
+++ b/configure
@@ -101,16 +101,10 @@ EXESUF=""
 # OS specific
 targetos=`uname -s`
 case $targetos in
-MINGW32*)
-mingw32="yes"
-;;
-DragonFly)
-noldl="yes"
-;;
-OpenBSD)
-noldl="yes"
-;;
-*) ;;
+  MINGW32*)  mingw32=yes;;
+  DragonFly) noldl=yes;;
+  OpenBSD)   noldl=yes;;
+  *) ;;
 esac
 
 # find source path
@@ -231,9 +225,9 @@ fi
 else
 
 # if cross compiling, cannot launch a program, so make a static guess
-if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" ; then
-bigendian="yes"
-fi
+case $cpu in
+  powerpc|mips|s390)  bigendian=yes;;
+esac
 
 fi
 

commit ba49862de6eb2c50fb6273568f2488c34b7c58f9
Author: Akim Demaille 
Date:   Fri Dec 21 13:47:00 2012 +0100

configure: prefer here-documents

* configure: use here-documents to improve readability and
reduce the clutter.

diff --git a/configure b/configure
index b440c5d..6467aaa 100755
--- a/configure
+++ b/configure
@@ -262,47 +262,45 @@ fi
 
 if test x"$show_help" = "xyes" ; then
 cat << EOF
-
 Usage: configure [options]
 Options: [defaults in brackets after descriptions]
 
+Standard options:
+  --help   print this message
+  --prefix=PREFIX  install in PREFIX [$prefix]
+  --exec-prefix=EPREFIXinstall architecture-dependent files in EPREFIX
+   [same as prefix]
+  --bindir=DIR user executables in DIR [EPREFIX/bin]
+  --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+  --tccdir=DIR installation directory [EPREFIX/lib/tcc]
+  --includedir=DIR C header files in DIR [PREFIX/include]
+  --sharedir=DIR   documentation root DIR [PREFIX]/share
+  --docdir=DIR documentation in DIR [SHAREDIR/doc/tcc]
+  --mandir=DIR man documentation in DIR [SHAREDIR/man]
+  --infodir=DIRinfo documentation in DIR [SHAREDIR/info]
+
+Advanced options (experts only):
+  --source-path=PATH   path of source code [$source_path]
+  --cross-prefix=PREFIXuse PREFIX for compile tools [$cross_prefix]
+  --sysroot=PREFIX prepend PREFIX to library/include paths []
+  --cc=CC  use C compiler CC [$cc]
+  --disable-static make libtcc.so instead of libtcc.a
+  --disable-rpath  disable use of -rpath with the above
+  --strip-binaries strip symbol tables from resulting binaries
+  --with-libgccuse /lib/libgcc_s.so.1 instead of libtcc.a
+  --enable-mingw32 build windows version on linux with mingw32
+  --enable-cygwin  build windows version on windows with cygwin
+   [requires cygwin and mingw32-make]
+  --enable-cross   build cross compilers
+  --extra-cflags=  extra compiler flags
+  --extra-ldflags= extra linker options
+  --with-selinux   use mmap instead of exec mem
+   [requires write access to /tmp]
+  --sysincludepaths=...specify system include paths, colon separated
+  --libpaths=...   specify system library paths, colon separated
+  --crtprefix=...  specify locations of crt?.o, colon separated
+  --elfinterp=...  specify elf interpreter
 EOF
-echo "Standard options:"
-echo "  --help   print this message"
-echo "  --prefix=PREFIX  install in PREFIX [$prefix]"
-echo "  --exec-prefix=EPREFIXinstall architecture-dependent files in 
EPREFIX"
-echo "   [sam

Re: [Tinycc-devel] VPATH builds

2012-12-19 Thread Akim Demaille

Le 19 déc. 2012 à 15:20, grischka  a écrit :

> Akim Demaille wrote:
>>>> I can provide help to provide other useful targets, such as 
> >>> "make dist" and "make distcheck".
>>> Thomas who manages a distro (debian) might want to comment.
> 
> Sorry, I meant: Thomas manages a tcc package for the debian distro.
> 
>> It is not so much related to distros than to the ability
>> to wrap correct tarballs.
> 
> I see.  Our tarballs here were made from a fresh git checkout except
> that tcc-doc.html was added and win32/build-tcc.bat was converted
> to CRLF endings:
>http://download.savannah.gnu.org/releases/tinycc/
> 
> See also:
>http://lists.gnu.org/archive/html/tinycc-devel/2012-12/msg6.html

Thanks for the pointer.

Well, it is very handy to have a trustable make dist,
and make distcheck, as you can fired it much more often,
or even hook a build farm on it.  Also, it helps checking
before pushing.

Time permitting, I'll provide an example of what I have
in mind.


___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] VPATH builds

2012-12-19 Thread Akim Demaille
Hi Grishka
Le 18 déc. 2012 à 21:29, grischka  a écrit :

>> I can provide help to provide other useful targets, such as "make dist" and 
>> "make distcheck".
> 
> Thomas who manages a distro (debian) might want to comment.

It is not so much related to distros than to the ability
to wrap correct tarballs.


>> Actually, is it on purpose that Autoconf and Automake are
>> not used?
> 
> I think so.  Tinycc is fast and small.  The Autospam chain stands for
> being obscenely slow and bloated.

Well, a lot of things can be said about these tools, but they get
the job done.

> Using it would damage Tinycc's karma.

As do broken VPATH builds and weirdly written Makefiles :)

>> What do you think about the VPATH-builds related changes?
> 
> I think it can't hurt provided it works.  Build directories for
> the cross-compilers (arm-tcc etc ...) would be nice too.
> 
> Btw, the term "VPATH-builds" seems to be an autospam metabolite, also.

Just suggest a name, I don't care much.  At least this one
is understood by some people.

> In an ideal world make would offer name- and option-spaces natively
> nowadays, and autospam would just bitrot somewhere as the small script
> that it was once before it became a virus.  ... I got distracted.

There are a lot of viruses that have spread over the world.
C for instance, who benefitted from the success of Unix.


___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] VPATH builds

2012-12-18 Thread Akim Demaille

Le 18 déc. 2012 à 15:42, grischka  a écrit :

> Akim Demaille wrote:
>> "make test" is uncommon, and a bit misleading since there is
>> a tests directory.  Would you object to using the more traditional
>> "make check"?
> 
> Sorry, but I don't really see how it is uncommon/misleading to run
> the tests in the "tests" directory with "make test".

Well, the shell is eager to complete on "tests" on tab.
And the Autotools support "make check", so it is quite
common.  There is no need to remove "test", check can
be a simple alias.

I can provide help to provide other useful targets, such
as "make dist" and "make distcheck".

Actually, is it on purpose that Autoconf and Automake are
not used?

> Anyway, if you want to revamp our tiny testsuite per se, for example
> split the tcctest.c mess into single tests (or theme related chunks)
> and/or integrate that with the (by someone recently added) tests2 stuff
> then I'll certainly not object to that. ;=)

I have still plenty to discover about tcc, but I'll have
a look :)

What do you think about the VPATH-builds related changes?
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] VPATH builds

2012-12-18 Thread Akim Demaille
Hi Grishka,

Le 16 déc. 2012 à 17:45, grischka  a écrit :

> Patches are welcome here: http://repo.or.cz/w/tinycc.git

I pushed there.

> A release is planned soon so please be careful.

Sure.  I'm not touching the sources.

> Also note that pushing a patch on our public branch means to share
> your work with other people, in the first place.

Of course.

> In that sense you might want to say one word at least about what
> "VPATH builds" means at all, and also to show typical usage of the
> feature with some commands example, for example.

I have added the following note in README:

> 1) Installation on a i386 Linux host (for Windows read tcc-win32.txt)
> 
>./configure
>make
>make test
>make install
> 
> Alternatively, VPATH builds are supported: you may use different
> directories to old build objects, kept separate from your source tree:
> 
>mkdir _build
>cd _build
>../configure
>make
>make test
>make install
> 
> By default, tcc is installed in /usr/local/bin.
> ./configure --help  shows configuration options.

"make test" is uncommon, and a bit misleading since there is
a tests directory.  Would you object to using the more traditional
"make check"?

Cheers!


___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] VPATH builds

2012-12-14 Thread Akim Demaille
Hi all,

The VPATH build in TCC seems to be broken.   I use only VPATH builds for many 
reasons, including the facility to use several compilers in parallel to check a 
single source tree.  The patch below fixes the VPATH builds.

Regards,

Akim

commit 6200894bd08894c3b2926aed621ec6ab649195de
Author: Akim Demaille 
Date:   Fri Dec 14 17:18:03 2012 +0100

  build: fix VPATH builds

  * configure (fn_dirname): New.
  Use it to ensure the creation of proper symlinks to Makefiles.
  (config.mak): Define top_builddir and top_srcdir.
  (CPPFLAGS): Be sure to find the headers.
  * Makefile, lib/Makefile, tests/Makefile, tests2/Makefile: Adjust
  to set VPATH properly.
  Fix confusion between top_builddir and top_srcdir.

diff --git a/Makefile b/Makefile
index 48ce697..48a8394 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,7 @@

TOP ?= .
include $(TOP)/config.mak
+VPATH = $(top_srcdir)

CPPFLAGS_P=$(CPPFLAGS) -DCONFIG_TCC_STATIC
CFLAGS_P=$(CFLAGS) -pg -static
@@ -356,11 +357,11 @@ tcc-doc.html: tcc-doc.texi
-texi2html -monolithic -number $<

tcc.1: tcc-doc.texi
-   -./texi2pod.pl $< tcc.pod
+   -$(top_srcdir)/texi2pod.pl $< tcc.pod
-pod2man --section=1 --center=" " --release=" " tcc.pod > $@

tcc-doc.info: tcc-doc.texi
-   -makeinfo tcc-doc.texi
+   -makeinfo $<

.PHONY: all clean tar distclean install uninstall FORCE

diff --git a/configure b/configure
index a400524..b4ac328 100755
--- a/configure
+++ b/configure
@@ -2,6 +2,14 @@
#
# tcc configure script (c) 2003 Fabrice Bellard

+fn_dirname()
+{
+  case $1 in
+*/*) echo "$1" | sed -e 's,/[^/]*,,';;
+  *) echo '.'
+  esac
+}
+
# set temporary file name
if test ! -z "$TMPDIR" ; then
   TMPDIR1="${TMPDIR}"
@@ -411,10 +419,13 @@ echo "#define GCC_MAJOR $gcc_major" >> $TMPH
echo "HOST_CC=$host_cc" >> config.mak
echo "AR=$ar" >> config.mak
echo "STRIP=$strip -s -R .comment -R .note" >> config.mak
-echo "CFLAGS=$CFLAGS" >> config.mak
-echo "LDFLAGS=$LDFLAGS" >> config.mak
-echo "LIBSUF=$LIBSUF" >> config.mak
-echo "EXESUF=$EXESUF" >> config.mak
+cat >> config.mak <> config.mak
@@ -491,16 +502,23 @@ echo "@set VERSION $version" > config.texi

# build tree in object directory if source path is different from current one
if test "$source_path_used" = "yes" ; then
-DIRS="tests"
-FILES="Makefile tests/Makefile"
-for dir in $DIRS ; do
-mkdir -p $dir
-done
+FILES="Makefile lib/Makefile tests/Makefile tests2/Makefile"
   for f in $FILES ; do
-ln -sf $source_path/$f $f
+dir=`fn_dirname "$f"`
+test -d "$dir" || mkdir -p "$dir"
+back=`echo "$source_path/$dir/" | sed 's,/\./,/,g;s,[^/]*/,../,g'`
+back=$back$f
+ln -sf $back $f
   done
fi
-echo "SRC_PATH=$source_path" >> config.mak
+cat >>config.mak <>config.mak

diff $TMPH config.h >/dev/null 2>&1
if test $? -ne 0 ; then
diff --git a/lib/Makefile b/lib/Makefile
index 6813052..a3e2cd1 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -4,6 +4,7 @@

TOP = ..
include $(TOP)/config.mak
+VPATH = $(top_srcdir)/lib $(top_srcdir)/win32/lib

ifndef TARGET
ifdef CONFIG_WIN64
@@ -42,8 +43,6 @@ X86_64_O = libtcc1.o alloca86_64.o
WIN32_O = $(I386_O) crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o bcheck.o
WIN64_O = $(X86_64_O) crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o

-VPATH = $(TOP)/lib $(TOP)/win32/lib
-
ifeq "$(TARGET)" "i386-win32"
OBJ = $(addprefix $(DIR)/,$(WIN32_O))
TGT = -DTCC_TARGET_I386 -DTCC_TARGET_PE
diff --git a/tests/Makefile b/tests/Makefile
index 116178f..c183342 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -4,6 +4,7 @@

TOP = ..
include $(TOP)/Makefile
+VPATH = $(top_srcdir)/tests

# what tests to run
TESTS = libtest \
@@ -56,7 +57,7 @@ endif
# run local version of tcc with local libraries and includes
TCC = ../tcc -B.. $(NATIVE_DEFINES)
ifdef CONFIG_WIN32
-   TCC := $(TCC) -I $(TOP)/win32/include -L$(TOP)
+   TCC := $(TCC) -I $(top_srcdir)/win32/include -L$(top_build)
endif
RUN_TCC = $(NATIVE_DEFINES) -run -DONE_SOURCE ../tcc.c -B..
DISAS=objdump -d
@@ -77,8 +78,8 @@ libtest: libtcc_test$(EXESUF) $(LIBTCC1)
@echo  $@ 
./libtcc_test$(EXESUF) lib_path=..

-libtcc_test$(EXESUF): libtcc_test.c ../$(LIBTCC)
-   $(CC) -o $@ $^ -I.. $(CPPFLAGS) $(CFLAGS) $(NATIVE_DEFINES) $(LIBS) 
$(LINK_LIBTCC) $(LDFLAGS)
+libtcc_test$(EXESUF): libtcc_test.c $(top_builddir)/$(LIBTCC)
+   $(CC) -o $@ $^ $(CPPFLAGS) $(CFLAGS) $(NATIVE_DEFINES) $(LIBS) 
$(LINK_LIBTCC) $(LDFLAGS)

# test.ref - generate using gcc
# copy only tcclib.h so GCC's stddef and stdarg will be used