tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] tcc -v with mob date?


From: Tyge Løvset
Subject: Re: [Tinycc-devel] tcc -v with mob date?
Date: Fri, 30 Dec 2022 01:26:28 +0100

Just a follow-up, here's a patch to update build-tcc.bat to be aligned with the linux Makefile.
I normally use it with MinGW-w64 gcc and it works well. Could anyone push this (I am unable to atm.)

Cheers,
Tyge.

diff --git a/win32/build-tcc.bat b/win32/build-tcc.bat
index 84c3888..830310c 100644
--- a/win32/build-tcc.bat
+++ b/win32/build-tcc.bat
@@ -11,8 +11,10 @@ git.exe --version 2>nul
 if not %ERRORLEVEL%==0 goto :git_done
 for /f %%b in ('git.exe rev-parse --abbrev-ref HEAD') do set GITHASH=%%b
 for /f %%h in ('git.exe rev-parse --short HEAD') do set GITHASH=%GITHASH%:%%h
+git.exe log -1 --pretty=format:%%cI > gitdate.txt
+for /f %%d in (gitdate.txt) do set GITHASH=%GITHASH% %%d
 git.exe diff --quiet
-if %ERRORLEVEL%==1 set GITHASH=%GITHASH%-mod
+if %ERRORLEVEL%==1 set GITHASH=%GITHASH% locally modified
 set DEF_GITHASH=-DTCC_GITHASH="""%GITHASH%"""
 :git_done
 set INST=


On Fri, 2 Dec 2022 at 08:56, Antoni Gual Via <antonigualvia@gmail.com> wrote:
Hello Christian
Unfortunately I'm not fluent enough on the linux shell to apply a patch like this. Some time ago Grichka suggested me a line allowing to get a 32 bit tcc added to the 64 bits the busybox is doing, and i have'nt been able to make it work.
It would be great to have a new version of tcc, that great no-nonsense compiler. Or a weekly build for windows, which I'm not able to maintain.
Antonio

Missatge de Christian Jullien <eligis@orange.fr> del dia dv., 2 de des. 2022 a les 6:13:

Hi, there are many ways to compile tcc on Windows.

Personally, I use Cygwin and gcc with this Makefile I wrote

http://svn.code.sf.net/p/wintcc/svn/cygwin/Makefile

 

It is more a shell script than a true Makefile (a mix of) but what I like with this way to build tcc is that it builds –m32/-m64 using 3 stages.

 

/cygdrive/f/tinycc/win32 $ make

# Stage 1

stage1: Bootstrapping 32bits and 64bits tools with gcc -m64

stage1: Building lib32 with tcc -m32

stage1: Building lib64 with tcc -m64

# Stage 2

stage2: Rebuild using tcc itself - default 64bits

stage2: Building lib32 with tcc -m32

stage2: Building lib64 with tcc -m64

# Stage 3

stage3: Rebuild using tcc itself - default 64bits

stage3: Building lib32 with tcc -m32

stage3: Building lib64 with tcc -m64

# Build is OK: stage2 == stage3

/cygdrive/f/tinycc/win32 $ ./tcc -v

tcc version 0.9.27 mob:702b802 2022-12-01T10:03:56+01:00 (x86_64 Windows)

 

I don’t know how you build tcc with BusyBox but you’ll probably have to add a patch similar to mine (somewhere)

 

Note that I only proposed a patch to maintainers but I’m glad someone took the responsibility to push it on mob (even if it is not the last and more accurate version of my patch).

 

IMHO, as tcc seems to be stuck forever to 0.9.27, having mod hash and date is not an option.

 

C.

 

From: tinycc-devel-bounces+eligis=orange.fr@nongnu.org [mailto:tinycc-devel-bounces+eligis=orange.fr@nongnu.org] On Behalf Of Antoni Gual Via
Sent: Thursday, December 01, 2022 21:43
To: tinycc-devel@nongnu.org
Subject: Re: [Tinycc-devel] tcc -v with mob date?

 

I think the patch is a great idea but...

I have just compiled tcc for Windows from the last snapshot, using Dimitri's BusyBox. Tcc's file date has updated to today's and I have tried the asm instruction popcnt and the strtoull function . Both work correctly. But to my surprise tcc -v does'nt give a clue about the snapshot version. 

I know Christian's patch is not yet included in the snapshot (it's too soon..) and i can't have yet the user readable version format. What i see is not even the machine readable serial. For me the version is still  

tcc version 0.9.27 (x86_64 Windows)

I thought you should be aware of it.

 

Regards

Antonio

 

Missatge de Christian Jullien <eligis@orange.fr> del dia dc., 30 de nov. 2022 a les 9:02:

Format has been lost, patch is in attachment this time

-----Original Message-----
From: tinycc-devel-bounces+eligis=orange.fr@nongnu.org [mailto:tinycc-devel-bounces+eligis=orange.fr@nongnu.org] On Behalf Of Christian Jullien
Sent: Wednesday, November 30, 2022 07:26
To: jullien@eligis.com; tinycc-devel@nongnu.org
Subject: Re: [Tinycc-devel] tcc -v with mob date?

This one is simpler and gives better info

jullien@mobley:~/tinycc $ git diff
diff --git a/Makefile b/Makefile
index efe0885..7543962 100644
--- a/Makefile
+++ b/Makefile
@@ -241,9 +241,12 @@ $(TCC_FILES) : DEFINES += -DONE_SOURCE=0
 $(X)tccpp.o : $(TCCDEFS_H)
 endif

-GITHASH := $(shell git rev-parse >/dev/null 2>&1 && git rev-parse --short HEAD || echo no)
-ifneq ($(GITHASH),no)
-DEF_GITHASH := -DTCC_GITHASH="\"$(shell git rev-parse --abbrev-ref HEAD):$(GITHASH)$(shell git diff --quiet || echo '-mod')\""
+FROM_GIT := $(shell git rev-parse >/dev/null 2>&1 && echo yes || echo no)
+
+ifeq ($(FROM_GIT),yes)
+GITHASH:=$(shell git rev-parse --abbrev-ref HEAD):$(shell git rev-parse --short HEAD) $(shell git log -1 --pretty='format:%cI')
+GITHASH+=$(shell git diff --quiet || echo locally modified)
+DEF_GITHASH := -DTCC_GITHASH="\"$(GITHASH)\""
 endif

 ifeq ($(CONFIG_debug),yes)


For example, with this uncommitted patch, it gives:

jullien@mobley:~/tinycc $ ./tcc -v
tcc version 0.9.27 mob:ac0604a 2022-11-29T21:13:20+01:00 locally modified (AArch64 Darwin)

C.

-----Original Message-----
From: tinycc-devel-bounces+eligis=orange.fr@nongnu.org [mailto:tinycc-devel-bounces+eligis=orange.fr@nongnu.org] On Behalf Of Christian Jullien
Sent: Tuesday, November 29, 2022 12:10
To: tinycc-devel@nongnu.org
Subject: [Tinycc-devel] tcc -v with mob date?

Hi,

Currently, tcc –v displays the (mob) githash which helps to identify which this version comes from.
It is not however user friendly.

I would like to add last commit date as:

jullien@sims4:~/tinycc $ ./tcc -v
tcc version 0.9.27 mob:afcdaf1 on 2022-11-29T00:56:26-06:00 (ARM eabihf Linux)

Maintainers, can you please apply a patch similar to this one?

jullien@sims4:~/tinycc $ git diff
diff --git a/Makefile b/Makefile
index efe0885..6377570 100644
--- a/Makefile
+++ b/Makefile
@@ -243,7 +243,12 @@ endif

 GITHASH := $(shell git rev-parse >/dev/null 2>&1 && git rev-parse --short HEAD || echo no)
 ifneq ($(GITHASH),no)
-DEF_GITHASH := -DTCC_GITHASH="\"$(shell git rev-parse --abbrev-ref HEAD):$(GITHASH)$(shell git diff --quiet || echo '-mod')\""
+DEF_GITHASH := -DTCC_GITHASH="\"$(shell git rev-parse --abbrev-ref HEAD):$(GITHASH)$(shell git diff --quiet || echo '-modified')\""
+endif
+
+GITDATE := $(shell git log -1 >/dev/null 2>&1 && git log -1 --pretty='format:%cI' || echo no)
+ifneq ($(GITDATE),no)
+DEF_GITDATE := -DTCC_GITDATE="\"$(shell git log -1 --pretty='format:%cI')\""
 endif

 ifeq ($(CONFIG_debug),yes)
@@ -265,7 +270,7 @@ $(X)%.o : %.c $(LIBTCC_INC)

 # additional dependencies
 $(X)tcc.o : tcctools.c
-$(X)tcc.o : DEFINES += $(DEF_GITHASH)
+$(X)tcc.o : DEFINES += $(DEF_GITHASH) $(DEF_GITDATE)

 # Host Tiny C Compiler
 tcc$(EXESUF): tcc.o $(LIBTCC)
diff --git a/tcc.c b/tcc.c
index beef6fb..da460cf 100644
--- a/tcc.c
+++ b/tcc.c
@@ -155,6 +155,9 @@ static const char version[] =
     "tcc version "TCC_VERSION
 #ifdef TCC_GITHASH
     " "TCC_GITHASH
+#endif
+#ifdef TCC_GITDATE
+    " on "TCC_GITDATE
 #endif
     " ("
 #ifdef TCC_TARGET_I386


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


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

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

Attachment: win32gitdate.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]