mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-25 04:43:33 +00:00
lang/tcc: Update version 0.9.25 => 0.9.26 and assign maintainer
PR: 191154 Submitted by: Carlos Jacobo Puga Medina Verified by: Redports x4 (i386-only)
This commit is contained in:
parent
706d15c991
commit
b8d66f2d08
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=358463
@ -1,29 +1,28 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PORTNAME= tcc
|
||||
PORTVERSION= 0.9.25
|
||||
PORTREVISION= 2
|
||||
PORTVERSION= 0.9.26
|
||||
CATEGORIES= lang
|
||||
MASTER_SITES= SAVANNAH/tinycc
|
||||
|
||||
MAINTAINER= ports@FreeBSD.org
|
||||
MAINTAINER= cjpugmed@gmail.com
|
||||
COMMENT= Tiny C Compiler
|
||||
|
||||
LICENSE= LGPL21
|
||||
|
||||
ONLY_FOR_ARCHS= i386
|
||||
#ONLY_FOR_ARCHS= i386 amd64 arm mips powerpc
|
||||
|
||||
CONFLICTS= TenDRA-*
|
||||
CONFLICTS= TenDRA-[0-9]*
|
||||
|
||||
USES= gmake perl5
|
||||
USE_BZIP2= yes
|
||||
USES= tar:bzip2 gmake perl5
|
||||
USE_PERL5= build
|
||||
HAS_CONFIGURE= yes
|
||||
CONFIGURE_ARGS= --prefix="${PREFIX}" --cc="${CC}"
|
||||
MAKE_ARGS= CONFIG_NOLDL=1
|
||||
|
||||
OPTIONS_DEFINE= DOCS
|
||||
OPTIONS_DEFINE= DOCS EXAMPLES
|
||||
|
||||
PORTDOCS= COPYING Changelog README TODO VERSION
|
||||
|
||||
.include <bsd.port.options.mk>
|
||||
|
||||
@ -37,8 +36,19 @@ PLIST_SUB+= I386="@comment "
|
||||
CFLAGS+= -fheinous-gnu-extensions
|
||||
.endif
|
||||
|
||||
.if ! ${PORT_OPTIONS:MDOCS}
|
||||
MAKE_ARGS+= NOPORTDOCS=1
|
||||
post-install:
|
||||
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/tcc
|
||||
${INSTALL_MAN} ${WRKSRC}/tcc.1 ${STAGEDIR}${MAN1PREFIX}/man/man1
|
||||
${INSTALL_DATA} ${WRKSRC}/lib/i386/bcheck.o ${STAGEDIR}${PREFIX}/lib/tcc/
|
||||
|
||||
.if ${PORT_OPTIONS:MDOCS}
|
||||
${MKDIR} ${STAGEDIR}${DOCSDIR}
|
||||
${INSTALL_DATA} ${PORTDOCS:S,^,${WRKSRC}/,} ${STAGEDIR}${DOCSDIR}
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MEXAMPLES}
|
||||
${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
|
||||
${INSTALL_DATA} ${WRKSRC}/examples/* ${STAGEDIR}${EXAMPLESDIR}
|
||||
.endif
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
@ -1,2 +1,2 @@
|
||||
SHA256 (tcc-0.9.25.tar.bz2) = 1bed6cb0fb2ef4100df1b94435d22863679e84cf419ec48ef96d9c0e9063de35
|
||||
SIZE (tcc-0.9.25.tar.bz2) = 382914
|
||||
SHA256 (tcc-0.9.26.tar.bz2) = 521e701ae436c302545c3f973a9c9b7e2694769c71d9be10f70a2460705b6d71
|
||||
SIZE (tcc-0.9.26.tar.bz2) = 525906
|
||||
|
@ -1,39 +0,0 @@
|
||||
The patches in this directory include some updates to tcc 0.9.25.
|
||||
Some of them have been committed in the main tcc repository so
|
||||
we will not need them in future updates.
|
||||
|
||||
In particular:
|
||||
|
||||
1. ELF file format (merged upstream)
|
||||
tcc 0.9.25 produces an ELF executable which is good for linux but
|
||||
not for FreeBSD. It misses the PHDR section which is almost
|
||||
mandatory for shared executables, puts in the .dynsym section
|
||||
some relocation info that FreeBSD expects to be in .got,
|
||||
and expect the relocation sections to be contiguous.
|
||||
|
||||
patch-tccelf.c tries to address the above problem using
|
||||
conditional sections (so hopefully can be imported upstream)
|
||||
and also adds the ability to override the name of the dynamic
|
||||
loader through an environment variable (this is important to
|
||||
debug tcc).
|
||||
|
||||
The resulting elf file is still not 100% correct -- if you strip it,
|
||||
the program will not run (presumably there is some dangling reference).
|
||||
Other than that, program do seem to run correctly.
|
||||
|
||||
2. predefined macros (partially merged upstream)
|
||||
patch-libtcc.c adds/fixes some predefined macros when compiling
|
||||
on FreeBSD: these are __FreeBSD__ and the usual set of
|
||||
__i386__ and __unix__ variants.
|
||||
It also #defines __builtin_inline(x,y), __PRETTY_FUNCTION__,
|
||||
__CC_SUPPORTS___INLINE, __aligned(x), __packed that are used
|
||||
in cdefs.h and by several user programs.
|
||||
Note that tcc recognises the __aligned__ and __packed__
|
||||
attributes but does not honor them.
|
||||
|
||||
3. -include, -M and other preprocessor directives
|
||||
patch-z1-preproc (name chosen because it must be applied after
|
||||
the other two) implements -include, -M (and related options),
|
||||
and makes tcc ignore -isystem and -std= which are often used
|
||||
to build code.
|
||||
|
@ -1,104 +0,0 @@
|
||||
--- Makefile.orig 2009-05-18 16:27:06.000000000 +0200
|
||||
+++ Makefile 2009-07-03 07:40:15.000000000 +0200
|
||||
@@ -28,6 +28,9 @@ endif
|
||||
ifeq ($(ARCH),x86-64)
|
||||
CFLAGS+=-Wno-pointer-sign
|
||||
endif
|
||||
+ifeq ($(ARCH),amd64)
|
||||
+CFLAGS+=-Wno-pointer-sign
|
||||
+endif
|
||||
|
||||
ifndef CONFIG_WIN32
|
||||
LIBS=-lm
|
||||
@@ -53,6 +56,11 @@ else
|
||||
ifeq ($(ARCH),x86-64)
|
||||
NATIVE_TARGET=-DTCC_TARGET_X86_64
|
||||
LIBTCC1=libtcc1.a
|
||||
+else
|
||||
+ifeq ($(ARCH),amd64)
|
||||
+NATIVE_TARGET=-DTCC_TARGET_X86_64
|
||||
+LIBTCC1=libtcc1.a
|
||||
+endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
@@ -99,6 +107,10 @@ ifeq ($(ARCH),x86-64)
|
||||
NATIVE_FILES=$(X86_64_FILES)
|
||||
PROGS_CROSS=$(I386_CROSS) $(WIN32_CROSS) $(ARM_CROSS) $(C67_CROSS)
|
||||
else
|
||||
+ifeq ($(ARCH),amd64)
|
||||
+NATIVE_FILES=$(X86_64_FILES)
|
||||
+PROGS_CROSS=$(I386_CROSS) $(WIN32_CROSS) $(ARM_CROSS) $(C67_CROSS)
|
||||
+else
|
||||
ifeq ($(ARCH),arm)
|
||||
NATIVE_FILES=$(ARM_FILES)
|
||||
PROGS_CROSS=$(I386_CROSS) $(X64_CROSS) $(WIN32_CROSS) $(C67_CROSS)
|
||||
@@ -106,6 +118,7 @@ endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
+endif
|
||||
|
||||
ifdef CONFIG_CROSS
|
||||
PROGS+=$(PROGS_CROSS)
|
||||
@@ -180,7 +193,7 @@ LIBTCC1_OBJS+=alloca86.o alloca86-bt.o
|
||||
endif
|
||||
|
||||
%.o: %.c
|
||||
- $(LIBTCC1_CC) -o $@ -c $< -O2 -Wall
|
||||
+ $(LIBTCC1_CC) -o $@ -c $< $(CFLAGS) -Wall
|
||||
|
||||
%.o: %.S
|
||||
$(LIBTCC1_CC) -o $@ -c $<
|
||||
@@ -189,7 +202,7 @@ libtcc1.a: $(LIBTCC1_OBJS)
|
||||
$(AR) rcs $@ $^
|
||||
|
||||
bcheck.o: bcheck.c
|
||||
- $(CC) -o $@ -c $< -O2 -Wall
|
||||
+ $(CC) -o $@ -c $< $(CFLAGS) -Wall
|
||||
|
||||
# install
|
||||
TCC_INCLUDES = stdarg.h stddef.h stdbool.h float.h varargs.h tcclib.h
|
||||
@@ -197,25 +210,27 @@ INSTALL=install
|
||||
|
||||
ifndef CONFIG_WIN32
|
||||
install: $(PROGS) $(LIBTCC1) $(BCHECK_O) libtcc.a tcc.1 tcc-doc.html
|
||||
- mkdir -p "$(bindir)"
|
||||
- $(INSTALL) -s -m755 $(PROGS) "$(bindir)"
|
||||
- mkdir -p "$(mandir)/man1"
|
||||
- $(INSTALL) tcc.1 "$(mandir)/man1"
|
||||
- mkdir -p "$(tccdir)"
|
||||
- mkdir -p "$(tccdir)/include"
|
||||
+ mkdir -p "$(DESTDIR)$(bindir)"
|
||||
+ $(INSTALL) -s -m755 $(PROGS) "$(DESTDIR)$(bindir)"
|
||||
+ mkdir -p "$(DESTDIR)$(mandir)/man1"
|
||||
+ $(INSTALL) tcc.1 "$(DESTDIR)$(mandir)/man1"
|
||||
+ mkdir -p "$(DESTDIR)$(tccdir)"
|
||||
+ mkdir -p "$(DESTDIR)$(tccdir)/include"
|
||||
ifneq ($(LIBTCC1),)
|
||||
- $(INSTALL) -m644 $(LIBTCC1) "$(tccdir)"
|
||||
+ $(INSTALL) -m644 $(LIBTCC1) "$(DESTDIR)$(tccdir)"
|
||||
endif
|
||||
ifneq ($(BCHECK_O),)
|
||||
- $(INSTALL) -m644 $(BCHECK_O) "$(tccdir)"
|
||||
+ $(INSTALL) -m644 $(BCHECK_O) "$(DESTDIR)$(tccdir)"
|
||||
endif
|
||||
- $(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) "$(tccdir)/include"
|
||||
- mkdir -p "$(docdir)"
|
||||
- $(INSTALL) -m644 tcc-doc.html "$(docdir)"
|
||||
- mkdir -p "$(libdir)"
|
||||
- $(INSTALL) -m644 libtcc.a "$(libdir)"
|
||||
- mkdir -p "$(includedir)"
|
||||
- $(INSTALL) -m644 libtcc.h "$(includedir)"
|
||||
+ $(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) "$(DESTDIR)$(tccdir)/include"
|
||||
+ifndef NOPORTDOCS
|
||||
+ mkdir -p "$(DESTDIR)$(docdir)"
|
||||
+ $(INSTALL) -m644 tcc-doc.html "$(DESTDIR)$(docdir)"
|
||||
+endif
|
||||
+ mkdir -p "$(DESTDIR)$(libdir)"
|
||||
+ $(INSTALL) -m644 libtcc.a "$(DESTDIR)$(libdir)"
|
||||
+ mkdir -p "$(DESTDIR)$(includedir)"
|
||||
+ $(INSTALL) -m644 libtcc.h "$(DESTDIR)$(includedir)"
|
||||
|
||||
uninstall:
|
||||
rm -fv $(foreach P,$(PROGS),"$(bindir)/$P")
|
@ -1,12 +0,0 @@
|
||||
--- configure.orig 2009-05-18 16:27:06.000000000 +0200
|
||||
+++ configure 2009-07-03 07:32:51.000000000 +0200
|
||||
@@ -38,6 +38,9 @@
|
||||
i386|i486|i586|i686|i86pc|BePC)
|
||||
cpu="x86"
|
||||
;;
|
||||
+ amd64)
|
||||
+ cpu="x86-64"
|
||||
+ ;;
|
||||
x86_64)
|
||||
cpu="x86-64"
|
||||
;;
|
@ -1,57 +0,0 @@
|
||||
diff -ubwr ./libtcc.c ../../work.2/tcc-0.9.25/libtcc.c
|
||||
--- ./libtcc.c 2009-05-18 16:27:06.000000000 +0200
|
||||
+++ ../../work.2/tcc-0.9.25/libtcc.c 2009-11-29 02:25:14.000000000 +0100
|
||||
@@ -1509,10 +1509,18 @@
|
||||
|
||||
if (level == 0) {
|
||||
/* XXX: only support linux */
|
||||
+#if defined(__FreeBSD__)
|
||||
+ *paddr = uc->uc_mcontext.mc_rip;
|
||||
+#else
|
||||
*paddr = uc->uc_mcontext.gregs[REG_RIP];
|
||||
+#endif
|
||||
return 0;
|
||||
} else {
|
||||
+#if defined(__FreeBSD__)
|
||||
+ fp = uc->uc_mcontext.mc_rbp;
|
||||
+#else
|
||||
fp = uc->uc_mcontext.gregs[REG_RBP];
|
||||
+#endif
|
||||
for(i=1;i<level;i++) {
|
||||
/* XXX: check address validity with program info */
|
||||
if (fp <= 0x1000)
|
||||
@@ -1784,7 +1792,9 @@
|
||||
tcc_define_symbol(s, "__STDC__", NULL);
|
||||
tcc_define_symbol(s, "__STDC_VERSION__", "199901L");
|
||||
#if defined(TCC_TARGET_I386)
|
||||
tcc_define_symbol(s, "__i386__", NULL);
|
||||
+ tcc_define_symbol(s, "__i386", NULL); /* NULL defaults to "1" */
|
||||
+ tcc_define_symbol(s, "i386", NULL);
|
||||
#endif
|
||||
#if defined(TCC_TARGET_X86_64)
|
||||
tcc_define_symbol(s, "__x86_64__", NULL);
|
||||
@@ -1802,6 +1812,14 @@
|
||||
#else
|
||||
tcc_define_symbol(s, "__unix__", NULL);
|
||||
tcc_define_symbol(s, "__unix", NULL);
|
||||
+ tcc_define_symbol(s, "unix", NULL);
|
||||
+#if defined(__FreeBSD__)
|
||||
+#define str(s) #s
|
||||
+ tcc_define_symbol(s, "__FreeBSD__", str( __FreeBSD__));
|
||||
+#undef str
|
||||
+ tcc_define_symbol(s, "__aligned(x)", "__attribute__((__aligned__(x)))");
|
||||
+ tcc_define_symbol(s, "__packed", "__attribute__((packed))");
|
||||
+#endif
|
||||
#if defined(__linux)
|
||||
tcc_define_symbol(s, "__linux__", NULL);
|
||||
tcc_define_symbol(s, "__linux", NULL);
|
||||
@@ -1834,6 +1841,9 @@
|
||||
tcc_define_symbol(s, "__TINYC__", NULL);
|
||||
|
||||
/* tiny C & gcc defines */
|
||||
+ tcc_define_symbol(s, "__CC_SUPPORTS___INLINE", NULL);
|
||||
+ tcc_define_symbol(s, "__builtin_inline(x,y)", "(x)");
|
||||
+ tcc_define_symbol(s, "__PRETTY_FUNCTION__", "__FUNCTION__");
|
||||
tcc_define_symbol(s, "__SIZE_TYPE__", "unsigned int");
|
||||
tcc_define_symbol(s, "__PTRDIFF_TYPE__", "int");
|
||||
#ifdef TCC_TARGET_PE
|
@ -1,175 +0,0 @@
|
||||
diff -ubwr ./tccelf.c ../../work.2/tcc-0.9.25/tccelf.c
|
||||
--- ./tccelf.c 2009-05-18 16:27:06.000000000 +0200
|
||||
+++ ../../work.2/tcc-0.9.25/tccelf.c 2009-11-29 02:12:36.000000000 +0100
|
||||
@@ -1273,7 +1273,7 @@
|
||||
|
||||
/* name of ELF interpreter */
|
||||
#if defined __FreeBSD__
|
||||
-static char elf_interp[] = "/usr/libexec/ld-elf.so.1";
|
||||
+static char elf_interp[] = "/libexec/ld-elf.so.1";
|
||||
#elif defined TCC_ARM_EABI
|
||||
static char elf_interp[] = "/lib/ld-linux.so.3";
|
||||
#elif defined(TCC_TARGET_X86_64)
|
||||
@@ -1306,6 +1306,31 @@
|
||||
}
|
||||
}
|
||||
|
||||
+#if defined(__FreeBSD__)
|
||||
+#define HAVE_PHDR 1
|
||||
+#define EXTRA_RELITEMS 14
|
||||
+
|
||||
+/* move the relocation value from .dynsym to .got */
|
||||
+void patch_dynsym_undef(TCCState *s1, Section *s)
|
||||
+{
|
||||
+ uint32_t *gotd = (void *)s1->got->data;
|
||||
+ ElfW(Sym) *sym, *sym_end;
|
||||
+
|
||||
+ gotd += 3; // dummy entries in .got
|
||||
+ /* relocate symbols in .dynsym */
|
||||
+ sym_end = (ElfW(Sym) *)(s->data + s->data_offset);
|
||||
+ for (sym = (ElfW(Sym) *)s->data + 1; sym < sym_end; sym++) {
|
||||
+ if (sym->st_shndx == SHN_UNDEF) {
|
||||
+ *gotd++ = sym->st_value + 6; // XXX 6 is magic ?
|
||||
+ sym->st_value = 0;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+#else
|
||||
+#define HAVE_PHDR 0
|
||||
+#define EXTRA_RELITEMS 9
|
||||
+#endif
|
||||
+
|
||||
/* output an ELF file */
|
||||
/* XXX: suppress unneeded sections */
|
||||
int elf_output_file(TCCState *s1, const char *filename)
|
||||
@@ -1324,6 +1349,7 @@
|
||||
ElfW(Sym) *sym;
|
||||
int type, file_type;
|
||||
unsigned long rel_addr, rel_size;
|
||||
+ unsigned long bss_addr, bss_size;
|
||||
|
||||
file_type = s1->output_type;
|
||||
s1->nb_errors = 0;
|
||||
@@ -1351,11 +1377,15 @@
|
||||
|
||||
if (file_type == TCC_OUTPUT_EXE) {
|
||||
char *ptr;
|
||||
+ /* allow override the dynamic loader */
|
||||
+ char *elfint = getenv("LD_SO");
|
||||
+ if (elfint == NULL)
|
||||
+ elfint = elf_interp;
|
||||
/* add interpreter section only if executable */
|
||||
interp = new_section(s1, ".interp", SHT_PROGBITS, SHF_ALLOC);
|
||||
interp->sh_addralign = 1;
|
||||
- ptr = section_ptr_add(interp, sizeof(elf_interp));
|
||||
- strcpy(ptr, elf_interp);
|
||||
+ ptr = section_ptr_add(interp, 1+strlen(elfint));
|
||||
+ strcpy(ptr, elfint);
|
||||
}
|
||||
|
||||
/* add dynamic symbol table */
|
||||
@@ -1514,7 +1544,7 @@
|
||||
|
||||
/* add necessary space for other entries */
|
||||
saved_dynamic_data_offset = dynamic->data_offset;
|
||||
- dynamic->data_offset += sizeof(ElfW(Dyn)) * 9;
|
||||
+ dynamic->data_offset += sizeof(ElfW(Dyn)) * EXTRA_RELITEMS;
|
||||
} else {
|
||||
/* still need to build got entries in case of static link */
|
||||
build_got_entries(s1);
|
||||
@@ -1543,7 +1573,7 @@
|
||||
break;
|
||||
case TCC_OUTPUT_EXE:
|
||||
if (!s1->static_link)
|
||||
- phnum = 4;
|
||||
+ phnum = 4 + HAVE_PHDR;
|
||||
else
|
||||
phnum = 2;
|
||||
break;
|
||||
@@ -1620,10 +1650,11 @@
|
||||
rel_size = 0;
|
||||
rel_addr = 0;
|
||||
|
||||
+ bss_addr = bss_size = 0;
|
||||
/* leave one program header for the program interpreter */
|
||||
ph = &phdr[0];
|
||||
if (interp)
|
||||
- ph++;
|
||||
+ ph += 1 + HAVE_PHDR;
|
||||
|
||||
for(j = 0; j < 2; j++) {
|
||||
ph->p_type = PT_LOAD;
|
||||
@@ -1685,9 +1716,20 @@
|
||||
}
|
||||
/* update dynamic relocation infos */
|
||||
if (s->sh_type == SHT_RELX) {
|
||||
+#if defined(__FreeBSD__)
|
||||
+ if (!strcmp(strsec->data + s->sh_name, ".rel.got")) { // rel_size == 0) {
|
||||
+ rel_addr = addr;
|
||||
+ rel_size += s->sh_size; // XXX only first rel.
|
||||
+ }
|
||||
+ if (!strcmp(strsec->data + s->sh_name, ".rel.bss")) { // rel_size == 0) {
|
||||
+ bss_addr = addr;
|
||||
+ bss_size = s->sh_size; // XXX only first rel.
|
||||
+ }
|
||||
+#else
|
||||
if (rel_size == 0)
|
||||
rel_addr = addr;
|
||||
rel_size += s->sh_size;
|
||||
+#endif
|
||||
}
|
||||
addr += s->sh_size;
|
||||
if (s->sh_type != SHT_NOBITS)
|
||||
@@ -1715,6 +1757,21 @@
|
||||
if (interp) {
|
||||
ph = &phdr[0];
|
||||
|
||||
+#if defined(__FreeBSD__)
|
||||
+ {
|
||||
+ int len = phnum * sizeof(ElfW(Phdr));
|
||||
+
|
||||
+ ph->p_type = PT_PHDR;
|
||||
+ ph->p_offset = sizeof(ElfW(Ehdr));
|
||||
+ ph->p_vaddr = interp->sh_addr - len;
|
||||
+ ph->p_paddr = ph->p_vaddr;
|
||||
+ ph->p_filesz = ph->p_memsz = len;
|
||||
+ ph->p_flags = PF_R | PF_X;
|
||||
+ ph->p_align = 4; // interp->sh_addralign;
|
||||
+ ph++;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
ph->p_type = PT_INTERP;
|
||||
ph->p_offset = interp->sh_offset;
|
||||
ph->p_vaddr = interp->sh_addr;
|
||||
@@ -1815,10 +1872,19 @@
|
||||
put_dt(dynamic, DT_RELASZ, rel_size);
|
||||
put_dt(dynamic, DT_RELAENT, sizeof(ElfW_Rel));
|
||||
#else
|
||||
+#if defined(__FreeBSD__)
|
||||
+ put_dt(dynamic, DT_PLTGOT, s1->got->sh_addr);
|
||||
+ put_dt(dynamic, DT_PLTRELSZ, rel_size);
|
||||
+ put_dt(dynamic, DT_JMPREL, rel_addr);
|
||||
+ put_dt(dynamic, DT_PLTREL, DT_REL);
|
||||
+ put_dt(dynamic, DT_REL, bss_addr);
|
||||
+ put_dt(dynamic, DT_RELSZ, bss_size);
|
||||
+#else
|
||||
put_dt(dynamic, DT_REL, rel_addr);
|
||||
put_dt(dynamic, DT_RELSZ, rel_size);
|
||||
put_dt(dynamic, DT_RELENT, sizeof(ElfW_Rel));
|
||||
#endif
|
||||
+#endif
|
||||
if (s1->do_debug)
|
||||
put_dt(dynamic, DT_DEBUG, 0);
|
||||
put_dt(dynamic, DT_NULL, 0);
|
||||
@@ -1950,6 +2016,10 @@
|
||||
for(i=1;i<s1->nb_sections;i++) {
|
||||
s = s1->sections[section_order[i]];
|
||||
if (s->sh_type != SHT_NOBITS) {
|
||||
+#if defined(__FreeBSD__)
|
||||
+ if (s->sh_type == SHT_DYNSYM)
|
||||
+ patch_dynsym_undef(s1, s);
|
||||
+#endif
|
||||
while (offset < s->sh_offset) {
|
||||
fputc(0, f);
|
||||
offset++;
|
@ -1,223 +0,0 @@
|
||||
diff -ubwr --exclude .svn ./libtcc.c /usr/ports-luigi/tcc/work/tcc-0.9.25/libtcc.c
|
||||
--- ./libtcc.c 2009-12-06 14:35:51.000000000 +0100
|
||||
+++ /usr/ports-luigi/tcc/work/tcc-0.9.25/libtcc.c 2009-12-06 14:34:34.000000000 +0100
|
||||
@@ -1108,7 +1108,15 @@
|
||||
bf->fd = fd;
|
||||
bf->buf_ptr = bf->buffer;
|
||||
bf->buf_end = bf->buffer;
|
||||
+ if (s1->include_len <= 0) {
|
||||
bf->buffer[0] = CH_EOB; /* put eob symbol */
|
||||
+ } else { /* add the list of -include */
|
||||
+ if (s1->include_len >= sizeof(bf->buffer))
|
||||
+ error("too many '-include directives %s\n", s1->include_buf);
|
||||
+ memcpy(bf->buf_ptr, s1->include_buf, s1->include_len);
|
||||
+ bf->buffer[s1->include_len] = CH_EOB; /* put eob symbol */
|
||||
+ s1->include_len = -s1->include_len;
|
||||
+ }
|
||||
pstrcpy(bf->filename, sizeof(bf->filename), filename);
|
||||
#ifdef _WIN32
|
||||
normalize_slashes(bf->filename);
|
||||
@@ -1945,6 +1955,9 @@
|
||||
if (ext[0])
|
||||
ext++;
|
||||
|
||||
+ /* enable -include on each new file */
|
||||
+ if (s1->include_len < 0)
|
||||
+ s1->include_len = -s1->include_len;
|
||||
/* open the file */
|
||||
saved_file = file;
|
||||
file = tcc_open(s1, filename);
|
||||
@@ -2121,7 +2134,9 @@
|
||||
{
|
||||
char buf[1024];
|
||||
|
||||
- s->output_type = output_type;
|
||||
+ s->output_type = output_type & 7;
|
||||
+ s->mode_m = output_type & 8;
|
||||
+ output_type = s->output_type;
|
||||
|
||||
if (!s->nostdinc) {
|
||||
/* default include paths */
|
||||
diff -ubwr --exclude .svn ./tcc.c /usr/ports-luigi/tcc/work/tcc-0.9.25/tcc.c
|
||||
--- ./tcc.c 2009-05-18 16:27:06.000000000 +0200
|
||||
+++ /usr/ports-luigi/tcc/work/tcc-0.9.25/tcc.c 2009-12-06 13:42:09.000000000 +0100
|
||||
@@ -66,6 +66,7 @@
|
||||
static int multiple_files;
|
||||
static int print_search_dirs;
|
||||
static int output_type;
|
||||
+static int mode_m;
|
||||
static int reloc_output;
|
||||
static const char *outfile;
|
||||
static int do_bench = 0;
|
||||
@@ -111,6 +112,10 @@
|
||||
TCC_OPTION_w,
|
||||
TCC_OPTION_pipe,
|
||||
TCC_OPTION_E,
|
||||
+ TCC_OPTION_M, /* -M and related options */
|
||||
+ TCC_OPTION_std, /* -std= */
|
||||
+ TCC_OPTION_isystem, /* -isystem x */
|
||||
+ TCC_OPTION_include, /* -include x */
|
||||
};
|
||||
|
||||
static const TCCOption tcc_options[] = {
|
||||
@@ -148,6 +153,10 @@
|
||||
{ "w", TCC_OPTION_w, 0 },
|
||||
{ "pipe", TCC_OPTION_pipe, 0},
|
||||
{ "E", TCC_OPTION_E, 0},
|
||||
+ { "M", TCC_OPTION_M, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
|
||||
+ { "std=", TCC_OPTION_std, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
|
||||
+ { "isystem", TCC_OPTION_isystem, TCC_OPTION_HAS_ARG },
|
||||
+ { "include", TCC_OPTION_include, TCC_OPTION_HAS_ARG },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
@@ -399,10 +408,45 @@
|
||||
}
|
||||
}
|
||||
break;
|
||||
+ case TCC_OPTION_include:
|
||||
+ {
|
||||
+ int len = strlen(optarg) + s->include_len + 12; /* #include ""\n */
|
||||
+ char *dst;
|
||||
+ s->include_buf = (s->include_len == 0) ?
|
||||
+ tcc_malloc(len + 1) :
|
||||
+ tcc_realloc(s->include_buf, len + 1);
|
||||
+ dst = s->include_buf + s->include_len;
|
||||
+ sprintf(dst, "#include \"%s\"\n", optarg);
|
||||
+ s->include_len = len; /* exclude '\0' */
|
||||
+ }
|
||||
+ break;
|
||||
+ case TCC_OPTION_isystem:
|
||||
+ break; /* ignore isystem */
|
||||
+ case TCC_OPTION_std:
|
||||
+ break; /* ignore -std= */
|
||||
+ case TCC_OPTION_M:
|
||||
+ mode_m |= 8;
|
||||
+ if (optarg[0] == '\0') /* plain -M */
|
||||
+ ;
|
||||
+ else if (optarg[0] == 'D') /* add output filename */
|
||||
+ ;
|
||||
+ else if (optarg[0] == 'F') { /* output filename */
|
||||
+ if (optind < argc)
|
||||
+ outfile = argv[optind++];
|
||||
+ } else if (optarg[0] == 'T') { /* target filename */
|
||||
+ if (optind < argc)
|
||||
+ s->target_name = argv[optind++];
|
||||
+ } else if (optarg[0] == 'P') { /* phony filename */
|
||||
+ ;
|
||||
+ } else {
|
||||
+ goto l_default;
|
||||
+ }
|
||||
+ /* FALLTHROUGH */
|
||||
case TCC_OPTION_E:
|
||||
output_type = TCC_OUTPUT_PREPROCESS;
|
||||
break;
|
||||
default:
|
||||
+l_default:
|
||||
if (s->warn_unsupported) {
|
||||
unsupported_option:
|
||||
warning("unsupported option '%s'", r);
|
||||
@@ -502,7 +546,7 @@
|
||||
start_time = getclock_us();
|
||||
}
|
||||
|
||||
- tcc_set_output_type(s, output_type);
|
||||
+ tcc_set_output_type(s, output_type | mode_m);
|
||||
|
||||
/* compile or add each files or library */
|
||||
for(i = 0; i < nb_files && ret == 0; i++) {
|
||||
diff -ubwr --exclude .svn ./tcc.h /usr/ports-luigi/tcc/work/tcc-0.9.25/tcc.h
|
||||
--- ./tcc.h 2009-05-18 16:27:06.000000000 +0200
|
||||
+++ /usr/ports-luigi/tcc/work/tcc-0.9.25/tcc.h 2009-12-06 13:28:32.000000000 +0100
|
||||
@@ -475,6 +475,10 @@
|
||||
|
||||
/* output file for preprocessing */
|
||||
FILE *outfile;
|
||||
+ int mode_m; /* tcc -M */
|
||||
+ const char *target_name; /* set with -MT or -MQ */
|
||||
+ char *include_buf; /* -include ... */
|
||||
+ int include_len; /* length of -include ... */
|
||||
|
||||
/* for tcc_relocate */
|
||||
int runtime_added;
|
||||
diff -ubwr --exclude .svn ./tccpp.c /usr/ports-luigi/tcc/work/tcc-0.9.25/tccpp.c
|
||||
--- ./tccpp.c 2009-05-18 16:27:06.000000000 +0200
|
||||
+++ /usr/ports-luigi/tcc/work/tcc-0.9.25/tccpp.c 2009-12-05 15:18:13.000000000 +0100
|
||||
@@ -2897,6 +2897,7 @@
|
||||
Sym *define_start;
|
||||
BufferedFile *file_ref;
|
||||
int token_seen, line_ref;
|
||||
+ const char *base_file;
|
||||
|
||||
preprocess_init(s1);
|
||||
define_start = define_stack;
|
||||
@@ -2908,6 +2909,15 @@
|
||||
line_ref = 0;
|
||||
file_ref = NULL;
|
||||
|
||||
+ base_file = file->filename;
|
||||
+ if (s1->mode_m) {
|
||||
+ int l = strlen(base_file);
|
||||
+ if (s1->target_name)
|
||||
+ fprintf(s1->outfile, "%s: %s", s1->target_name, base_file);
|
||||
+ else
|
||||
+ fprintf(s1->outfile, "%.*s.o: %s", l-2, base_file, base_file);
|
||||
+ }
|
||||
+
|
||||
for (;;) {
|
||||
next();
|
||||
if (tok == TOK_EOF) {
|
||||
@@ -2919,16 +2929,25 @@
|
||||
token_seen = 0;
|
||||
} else if (!token_seen) {
|
||||
int d = file->line_num - line_ref;
|
||||
+ if (s1->mode_m) {
|
||||
+ if (file != file_ref && file->filename != base_file &&
|
||||
+ !search_cached_include(s1, '>', file->filename))
|
||||
+ fprintf(s1->outfile, " \\\n %s", file->filename);
|
||||
+ } else {
|
||||
if (file != file_ref || d < 0 || d >= 8)
|
||||
fprintf(s1->outfile, "# %d \"%s\"\n", file->line_num, file->filename);
|
||||
else
|
||||
while (d)
|
||||
fputs("\n", s1->outfile), --d;
|
||||
+ }
|
||||
line_ref = (file_ref = file)->line_num;
|
||||
token_seen = 1;
|
||||
}
|
||||
+ if (!s1->mode_m)
|
||||
fputs(get_tok_str(tok, &tokc), s1->outfile);
|
||||
}
|
||||
+ if (s1->mode_m)
|
||||
+ fprintf(s1->outfile, "\n");
|
||||
free_defines(define_start);
|
||||
return 0;
|
||||
}
|
||||
diff -ubwr --exclude .svn ./tcc.c /usr/ports-luigi/tcc/work/tcc-0.9.25/tcc.c
|
||||
--- ./tcc.c 2009-12-06 15:42:02.000000000 +0100
|
||||
+++ /usr/ports-luigi/tcc/work/tcc-0.9.25/tcc.c 2009-12-06 15:42:40.000000000 +0100
|
||||
@@ -40,8 +40,11 @@
|
||||
"Preprocessor options:\n"
|
||||
" -E preprocess only\n"
|
||||
" -Idir add include path 'dir'\n"
|
||||
+ " -include f #include file 'f' before everything else\n"
|
||||
" -Dsym[=val] define 'sym' with value 'val'\n"
|
||||
" -Usym undefine 'sym'\n"
|
||||
+ " -M generate include list. Implies -E\n"
|
||||
+ " -MT file use 'file' as target for -M.\n"
|
||||
"Linker options:\n"
|
||||
" -Ldir add library path 'dir'\n"
|
||||
" -llib link with dynamic or static library 'lib'\n"
|
||||
@@ -58,6 +61,12 @@
|
||||
#ifdef CONFIG_TCC_BACKTRACE
|
||||
" -bt N show N callers in stack traces\n"
|
||||
#endif
|
||||
+ "Ignored options (for gcc compatibility):\n"
|
||||
+ " -std=X \n"
|
||||
+ " -MD name\n"
|
||||
+ " -MP\n"
|
||||
+ " -isystem dir\n"
|
||||
+
|
||||
);
|
||||
}
|
||||
|
@ -1,431 +0,0 @@
|
||||
#! /usr/bin/perl -w
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
# This file is part of GNU CC.
|
||||
|
||||
# GNU CC is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# GNU CC is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GNU CC; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
# Boston MA 02111-1307, USA.
|
||||
|
||||
# This does trivial (and I mean _trivial_) conversion of Texinfo
|
||||
# markup to Perl POD format. It's intended to be used to extract
|
||||
# something suitable for a manpage from a Texinfo document.
|
||||
|
||||
$output = 0;
|
||||
$skipping = 0;
|
||||
%sects = ();
|
||||
$section = "";
|
||||
@icstack = ();
|
||||
@endwstack = ();
|
||||
@skstack = ();
|
||||
@instack = ();
|
||||
$shift = "";
|
||||
%defs = ();
|
||||
$fnno = 1;
|
||||
$inf = "";
|
||||
$ibase = "";
|
||||
|
||||
while ($_ = shift) {
|
||||
if (/^-D(.*)$/) {
|
||||
if ($1 ne "") {
|
||||
$flag = $1;
|
||||
} else {
|
||||
$flag = shift;
|
||||
}
|
||||
$value = "";
|
||||
($flag, $value) = ($flag =~ /^([^=]+)(?:=(.+))?/);
|
||||
die "no flag specified for -D\n"
|
||||
unless $flag ne "";
|
||||
die "flags may only contain letters, digits, hyphens, dashes and underscores\n"
|
||||
unless $flag =~ /^[a-zA-Z0-9_-]+$/;
|
||||
$defs{$flag} = $value;
|
||||
} elsif (/^-/) {
|
||||
usage();
|
||||
} else {
|
||||
$in = $_, next unless defined $in;
|
||||
$out = $_, next unless defined $out;
|
||||
usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (defined $in) {
|
||||
$inf = gensym();
|
||||
open($inf, "<$in") or die "opening \"$in\": $!\n";
|
||||
$ibase = $1 if $in =~ m|^(.+)/[^/]+$|;
|
||||
} else {
|
||||
$inf = \*STDIN;
|
||||
}
|
||||
|
||||
if (defined $out) {
|
||||
open(STDOUT, ">$out") or die "opening \"$out\": $!\n";
|
||||
}
|
||||
|
||||
while(defined $inf) {
|
||||
while(<$inf>) {
|
||||
# Certain commands are discarded without further processing.
|
||||
/^\@(?:
|
||||
[a-z]+index # @*index: useful only in complete manual
|
||||
|need # @need: useful only in printed manual
|
||||
|(?:end\s+)?group # @group .. @end group: ditto
|
||||
|page # @page: ditto
|
||||
|node # @node: useful only in .info file
|
||||
|(?:end\s+)?ifnottex # @ifnottex .. @end ifnottex: use contents
|
||||
)\b/x and next;
|
||||
|
||||
chomp;
|
||||
|
||||
# Look for filename and title markers.
|
||||
/^\@setfilename\s+([^.]+)/ and $fn = $1, next;
|
||||
/^\@settitle\s+([^.]+)/ and $tl = postprocess($1), next;
|
||||
|
||||
# Identify a man title but keep only the one we are interested in.
|
||||
/^\@c\s+man\s+title\s+([A-Za-z0-9-]+)\s+(.+)/ and do {
|
||||
if (exists $defs{$1}) {
|
||||
$fn = $1;
|
||||
$tl = postprocess($2);
|
||||
}
|
||||
next;
|
||||
};
|
||||
|
||||
# Look for blocks surrounded by @c man begin SECTION ... @c man end.
|
||||
# This really oughta be @ifman ... @end ifman and the like, but such
|
||||
# would require rev'ing all other Texinfo translators.
|
||||
/^\@c\s+man\s+begin\s+([A-Z]+)\s+([A-Za-z0-9-]+)/ and do {
|
||||
$output = 1 if exists $defs{$2};
|
||||
$sect = $1;
|
||||
next;
|
||||
};
|
||||
/^\@c\s+man\s+begin\s+([A-Z]+)/ and $sect = $1, $output = 1, next;
|
||||
/^\@c\s+man\s+end/ and do {
|
||||
$sects{$sect} = "" unless exists $sects{$sect};
|
||||
$sects{$sect} .= postprocess($section);
|
||||
$section = "";
|
||||
$output = 0;
|
||||
next;
|
||||
};
|
||||
|
||||
# handle variables
|
||||
/^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and do {
|
||||
$defs{$1} = $2;
|
||||
next;
|
||||
};
|
||||
/^\@clear\s+([a-zA-Z0-9_-]+)/ and do {
|
||||
delete $defs{$1};
|
||||
next;
|
||||
};
|
||||
|
||||
next unless $output;
|
||||
|
||||
# Discard comments. (Can't do it above, because then we'd never see
|
||||
# @c man lines.)
|
||||
/^\@c\b/ and next;
|
||||
|
||||
# End-block handler goes up here because it needs to operate even
|
||||
# if we are skipping.
|
||||
/^\@end\s+([a-z]+)/ and do {
|
||||
# Ignore @end foo, where foo is not an operation which may
|
||||
# cause us to skip, if we are presently skipping.
|
||||
my $ended = $1;
|
||||
next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex)$/;
|
||||
|
||||
die "\@end $ended without \@$ended at line $.\n" unless defined $endw;
|
||||
die "\@$endw ended by \@end $ended at line $.\n" unless $ended eq $endw;
|
||||
|
||||
$endw = pop @endwstack;
|
||||
|
||||
if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex)$/) {
|
||||
$skipping = pop @skstack;
|
||||
next;
|
||||
} elsif ($ended =~ /^(?:example|smallexample|display)$/) {
|
||||
$shift = "";
|
||||
$_ = ""; # need a paragraph break
|
||||
} elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) {
|
||||
$_ = "\n=back\n";
|
||||
$ic = pop @icstack;
|
||||
} else {
|
||||
die "unknown command \@end $ended at line $.\n";
|
||||
}
|
||||
};
|
||||
|
||||
# We must handle commands which can cause skipping even while we
|
||||
# are skipping, otherwise we will not process nested conditionals
|
||||
# correctly.
|
||||
/^\@ifset\s+([a-zA-Z0-9_-]+)/ and do {
|
||||
push @endwstack, $endw;
|
||||
push @skstack, $skipping;
|
||||
$endw = "ifset";
|
||||
$skipping = 1 unless exists $defs{$1};
|
||||
next;
|
||||
};
|
||||
|
||||
/^\@ifclear\s+([a-zA-Z0-9_-]+)/ and do {
|
||||
push @endwstack, $endw;
|
||||
push @skstack, $skipping;
|
||||
$endw = "ifclear";
|
||||
$skipping = 1 if exists $defs{$1};
|
||||
next;
|
||||
};
|
||||
|
||||
/^\@(ignore|menu|iftex)\b/ and do {
|
||||
push @endwstack, $endw;
|
||||
push @skstack, $skipping;
|
||||
$endw = $1;
|
||||
$skipping = 1;
|
||||
next;
|
||||
};
|
||||
|
||||
next if $skipping;
|
||||
|
||||
# Character entities. First the ones that can be replaced by raw text
|
||||
# or discarded outright:
|
||||
s/\@copyright\{\}/(c)/g;
|
||||
s/\@dots\{\}/.../g;
|
||||
s/\@enddots\{\}/..../g;
|
||||
s/\@([.!? ])/$1/g;
|
||||
s/\@[:-]//g;
|
||||
s/\@bullet(?:\{\})?/*/g;
|
||||
s/\@TeX\{\}/TeX/g;
|
||||
s/\@pounds\{\}/\#/g;
|
||||
s/\@minus(?:\{\})?/-/g;
|
||||
s/\\,/,/g;
|
||||
|
||||
# Now the ones that have to be replaced by special escapes
|
||||
# (which will be turned back into text by unmunge())
|
||||
s/&/&/g;
|
||||
s/\@\{/{/g;
|
||||
s/\@\}/}/g;
|
||||
s/\@\@/&at;/g;
|
||||
|
||||
# Inside a verbatim block, handle @var specially.
|
||||
if ($shift ne "") {
|
||||
s/\@var\{([^\}]*)\}/<$1>/g;
|
||||
}
|
||||
|
||||
# POD doesn't interpret E<> inside a verbatim block.
|
||||
if ($shift eq "") {
|
||||
s/</</g;
|
||||
s/>/>/g;
|
||||
} else {
|
||||
s/</</g;
|
||||
s/>/>/g;
|
||||
}
|
||||
|
||||
# Single line command handlers.
|
||||
|
||||
/^\@include\s+(.+)$/ and do {
|
||||
push @instack, $inf;
|
||||
$inf = gensym();
|
||||
|
||||
# Try cwd and $ibase.
|
||||
open($inf, "<" . $1)
|
||||
or open($inf, "<" . $ibase . "/" . $1)
|
||||
or die "cannot open $1 or $ibase/$1: $!\n";
|
||||
next;
|
||||
};
|
||||
|
||||
/^\@(?:section|unnumbered|unnumberedsec|center)\s+(.+)$/
|
||||
and $_ = "\n=head2 $1\n";
|
||||
/^\@subsection\s+(.+)$/
|
||||
and $_ = "\n=head3 $1\n";
|
||||
|
||||
# Block command handlers:
|
||||
/^\@itemize\s+(\@[a-z]+|\*|-)/ and do {
|
||||
push @endwstack, $endw;
|
||||
push @icstack, $ic;
|
||||
$ic = $1;
|
||||
$_ = "\n=over 4\n";
|
||||
$endw = "itemize";
|
||||
};
|
||||
|
||||
/^\@enumerate(?:\s+([a-zA-Z0-9]+))?/ and do {
|
||||
push @endwstack, $endw;
|
||||
push @icstack, $ic;
|
||||
if (defined $1) {
|
||||
$ic = $1 . ".";
|
||||
} else {
|
||||
$ic = "1.";
|
||||
}
|
||||
$_ = "\n=over 4\n";
|
||||
$endw = "enumerate";
|
||||
};
|
||||
|
||||
/^\@([fv]?table)\s+(\@[a-z]+)/ and do {
|
||||
push @endwstack, $endw;
|
||||
push @icstack, $ic;
|
||||
$endw = $1;
|
||||
$ic = $2;
|
||||
$ic =~ s/\@(?:samp|strong|key|gcctabopt|env)/B/;
|
||||
$ic =~ s/\@(?:code|kbd)/C/;
|
||||
$ic =~ s/\@(?:dfn|var|emph|cite|i)/I/;
|
||||
$ic =~ s/\@(?:file)/F/;
|
||||
$_ = "\n=over 4\n";
|
||||
};
|
||||
|
||||
/^\@((?:small)?example|display)/ and do {
|
||||
push @endwstack, $endw;
|
||||
$endw = $1;
|
||||
$shift = "\t";
|
||||
$_ = ""; # need a paragraph break
|
||||
};
|
||||
|
||||
/^\@itemx?\s*(.+)?$/ and do {
|
||||
if (defined $1) {
|
||||
# Entity escapes prevent munging by the <> processing below.
|
||||
$_ = "\n=item $ic\<$1\>\n";
|
||||
} else {
|
||||
$_ = "\n=item $ic\n";
|
||||
$ic =~ y/A-Ya-y/B-Zb-z/;
|
||||
$ic =~ s/(\d+)/$1 + 1/eg;
|
||||
}
|
||||
};
|
||||
|
||||
$section .= $shift.$_."\n";
|
||||
}
|
||||
# End of current file.
|
||||
close($inf);
|
||||
$inf = pop @instack;
|
||||
}
|
||||
|
||||
die "No filename or title\n" unless defined $fn && defined $tl;
|
||||
|
||||
$sects{NAME} = "$fn \- $tl\n";
|
||||
$sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES};
|
||||
|
||||
for $sect (qw(NAME SYNOPSIS DESCRIPTION OPTIONS ENVIRONMENT FILES
|
||||
BUGS NOTES FOOTNOTES SEEALSO AUTHOR COPYRIGHT)) {
|
||||
if(exists $sects{$sect}) {
|
||||
$head = $sect;
|
||||
$head =~ s/SEEALSO/SEE ALSO/;
|
||||
print "=head1 $head\n\n";
|
||||
print scalar unmunge ($sects{$sect});
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub usage
|
||||
{
|
||||
die "usage: $0 [-D toggle...] [infile [outfile]]\n";
|
||||
}
|
||||
|
||||
sub postprocess
|
||||
{
|
||||
local $_ = $_[0];
|
||||
|
||||
# @value{foo} is replaced by whatever 'foo' is defined as.
|
||||
while (m/(\@value\{([a-zA-Z0-9_-]+)\})/g) {
|
||||
if (! exists $defs{$2}) {
|
||||
print STDERR "Option $2 not defined\n";
|
||||
s/\Q$1\E//;
|
||||
} else {
|
||||
$value = $defs{$2};
|
||||
s/\Q$1\E/$value/;
|
||||
}
|
||||
}
|
||||
|
||||
# Formatting commands.
|
||||
# Temporary escape for @r.
|
||||
s/\@r\{([^\}]*)\}/R<$1>/g;
|
||||
s/\@(?:dfn|var|emph|cite|i)\{([^\}]*)\}/I<$1>/g;
|
||||
s/\@(?:code|kbd)\{([^\}]*)\}/C<$1>/g;
|
||||
s/\@(?:gccoptlist|samp|strong|key|option|env|command|b)\{([^\}]*)\}/B<$1>/g;
|
||||
s/\@sc\{([^\}]*)\}/\U$1/g;
|
||||
s/\@file\{([^\}]*)\}/F<$1>/g;
|
||||
s/\@w\{([^\}]*)\}/S<$1>/g;
|
||||
s/\@(?:dmn|math)\{([^\}]*)\}/$1/g;
|
||||
|
||||
# Cross references are thrown away, as are @noindent and @refill.
|
||||
# (@noindent is impossible in .pod, and @refill is unnecessary.)
|
||||
# @* is also impossible in .pod; we discard it and any newline that
|
||||
# follows it. Similarly, our macro @gol must be discarded.
|
||||
|
||||
s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g;
|
||||
s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g;
|
||||
s/;\s+\@pxref\{(?:[^\}]*)\}//g;
|
||||
s/\@noindent\s*//g;
|
||||
s/\@refill//g;
|
||||
s/\@gol//g;
|
||||
s/\@\*\s*\n?//g;
|
||||
|
||||
# @uref can take one, two, or three arguments, with different
|
||||
# semantics each time. @url and @email are just like @uref with
|
||||
# one argument, for our purposes.
|
||||
s/\@(?:uref|url|email)\{([^\},]*)\}/<B<$1>>/g;
|
||||
s/\@uref\{([^\},]*),([^\},]*)\}/$2 (C<$1>)/g;
|
||||
s/\@uref\{([^\},]*),([^\},]*),([^\},]*)\}/$3/g;
|
||||
|
||||
# Un-escape <> at this point.
|
||||
s/</</g;
|
||||
s/>/>/g;
|
||||
|
||||
# Now un-nest all B<>, I<>, R<>. Theoretically we could have
|
||||
# indefinitely deep nesting; in practice, one level suffices.
|
||||
1 while s/([BIR])<([^<>]*)([BIR])<([^<>]*)>/$1<$2>$3<$4>$1</g;
|
||||
|
||||
# Replace R<...> with bare ...; eliminate empty markup, B<>;
|
||||
# shift white space at the ends of [BI]<...> expressions outside
|
||||
# the expression.
|
||||
s/R<([^<>]*)>/$1/g;
|
||||
s/[BI]<>//g;
|
||||
s/([BI])<(\s+)([^>]+)>/$2$1<$3>/g;
|
||||
s/([BI])<([^>]+?)(\s+)>/$1<$2>$3/g;
|
||||
|
||||
# Extract footnotes. This has to be done after all other
|
||||
# processing because otherwise the regexp will choke on formatting
|
||||
# inside @footnote.
|
||||
while (/\@footnote/g) {
|
||||
s/\@footnote\{([^\}]+)\}/[$fnno]/;
|
||||
add_footnote($1, $fnno);
|
||||
$fnno++;
|
||||
}
|
||||
|
||||
return $_;
|
||||
}
|
||||
|
||||
sub unmunge
|
||||
{
|
||||
# Replace escaped symbols with their equivalents.
|
||||
local $_ = $_[0];
|
||||
|
||||
s/</E<lt>/g;
|
||||
s/>/E<gt>/g;
|
||||
s/{/\{/g;
|
||||
s/}/\}/g;
|
||||
s/&at;/\@/g;
|
||||
s/&/&/g;
|
||||
return $_;
|
||||
}
|
||||
|
||||
sub add_footnote
|
||||
{
|
||||
unless (exists $sects{FOOTNOTES}) {
|
||||
$sects{FOOTNOTES} = "\n=over 4\n\n";
|
||||
}
|
||||
|
||||
$sects{FOOTNOTES} .= "=item $fnno.\n\n"; $fnno++;
|
||||
$sects{FOOTNOTES} .= $_[0];
|
||||
$sects{FOOTNOTES} .= "\n\n";
|
||||
}
|
||||
|
||||
# stolen from Symbol.pm
|
||||
{
|
||||
my $genseq = 0;
|
||||
sub gensym
|
||||
{
|
||||
my $name = "GEN" . $genseq++;
|
||||
my $ref = \*{$name};
|
||||
delete $::{$name};
|
||||
return $ref;
|
||||
}
|
||||
}
|
@ -1,16 +1,26 @@
|
||||
bin/tcc
|
||||
include/libtcc.h
|
||||
lib/libtcc.a
|
||||
%%I386%%lib/tcc/bcheck.o
|
||||
lib/tcc/include/float.h
|
||||
lib/tcc/include/stdarg.h
|
||||
lib/tcc/include/stdbool.h
|
||||
lib/tcc/include/stddef.h
|
||||
lib/tcc/include/tcclib.h
|
||||
lib/tcc/include/varargs.h
|
||||
lib/tcc/bcheck.o
|
||||
lib/tcc/libtcc1.a
|
||||
man/man1/tcc.1.gz
|
||||
share/info/tcc-doc.info
|
||||
share/man/man1/tcc.1
|
||||
@dirrm lib/tcc/include
|
||||
@dirrm lib/tcc
|
||||
@dirrmtry share/info
|
||||
@dirrmtry share/man/man1
|
||||
@dirrmtry share/man
|
||||
%%PORTDOCS%%%%DOCSDIR%%/tcc-doc.html
|
||||
%%PORTDOCS%%@dirrm %%DOCSDIR%%
|
||||
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/ex1.c
|
||||
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/ex2.c
|
||||
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/ex3.c
|
||||
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/ex4.c
|
||||
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/ex5.c
|
||||
%%PORTEXAMPLES%%@dirrmtry %%EXAMPLESDIR%%
|
||||
|
Loading…
Reference in New Issue
Block a user