- Added compress target to Makefile.linux32 (Uses UPX)

- Fixed TCC for linux bug: does not find library and headers as well as start.o
- Updated kos32-tcc

git-svn-id: svn://kolibrios.org@8272 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
superturbocat2001 2020-11-28 19:19:06 +00:00
parent 712b555519
commit dbc1c764b1
3 changed files with 26 additions and 4 deletions

View File

@ -2,12 +2,14 @@ CC=gcc
NAME=kos32-tcc
SRC=libtcc.c tcc.c
CFLAGS= -DTCC_TARGET_MEOS_LINUX
CFLAGS= -DTCC_TARGET_MEOS_LINUX
LFLAGS= -m32 -static
all:
$(CC) $(CFLAGS) $(LFLAGS) $(SRC) -o $(NAME)
install:
cp $(NAME) ../bin
compress:
upx $(NAME)
clean:
rm -f $(NAME)

View File

@ -71,6 +71,10 @@ ST_DATA struct TCCState *tcc_state;
#ifdef TCC_TARGET_MEOS
#include "tccmeos.c"
#endif
#ifdef TCC_TARGET_MEOS_LINUX
#include <libgen.h>
#endif
#endif /* ONE_SOURCE */
@ -140,7 +144,7 @@ BOOL WINAPI DllMain (HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved)
}
#endif
#else // _WIN32
#if defined TCC_TARGET_MEOS && ! TCC_TARGET_MEOS_LINUX
#if defined TCC_TARGET_MEOS
/* on Kolibri host, we suppose the lib and includes are at the location of 'tcc' /lib, /include */
static void tcc_set_lib_path_kos(TCCState *s)
{
@ -152,9 +156,19 @@ static void tcc_set_lib_path_kos(TCCState *s)
*p = 0;
tcc_set_lib_path(s, path);
}
#endif
#endif
#if defined TCC_TARGET_MEOS_LINUX
static void tcc_set_lib_path_linux(TCCState *s)
{
char buff[4096+1];
readlink("/proc/self/exe", buff, 4096);
const char *path = dirname(buff);
tcc_set_lib_path(s, path);
}
#endif
#endif
#endif
/********************************************************/
/* copy a string and truncate it. */
PUB_FUNC char *pstrcpy(char *buf, int buf_size, const char *s)
@ -1092,11 +1106,17 @@ LIBTCCAPI TCCState *tcc_new(void)
#ifdef _WIN32
tcc_set_lib_path_w32(s);
#else
#if defined TCC_TARGET_MEOS && ! TCC_TARGET_MEOS_LINUX
tcc_set_lib_path_kos(s);
#else
#ifdef TCC_TARGET_MEOS_LINUX
tcc_set_lib_path_linux(s);
#else
tcc_set_lib_path(s, CONFIG_TCCDIR);
#endif
#endif
#endif
s->output_type = 0;
preprocess_new();