On 05/29/18 23:12, Brian Callahan wrote:

On 05/23/18 23:15, Brian Callahan wrote:
Hi ports --

I'd like to push a pl1 to libfirm and cparser. I got upstream to commit patches 
to recognize OpenBSD as a platform and there are some nice improvements to the 
compiler (notably, cparser can now rebuild libfirm and itself, at least on 
amd64).

I'd also like to switch from cmake to gmake, since upstream really only 
supports gmake (and the cmake stuff is currently broken).

Is anyone else using this besides me? i386 tests would be very appreciated.

OK?

~Brian


Ping. In the meantime, there was some extra commits made, so new diff.

~Brian


I get that I'm the only one using this, but I would still like to commit this 
update. Besides the code update, it'll be easier to commit updates going 
forward with this.

I've taken the famous children's netbook out of retirement as an i386 machine 
and can confirm everything is happy with this new update there as well.

Update to latest code, while here.

~Brian

Index: devel/libfirm/Makefile
===================================================================
RCS file: /cvs/ports/devel/libfirm/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makefile
--- devel/libfirm/Makefile	6 Nov 2017 01:19:16 -0000	1.1.1.1
+++ devel/libfirm/Makefile	14 Jun 2018 23:45:01 -0000
@@ -5,15 +5,15 @@ ONLY_FOR_ARCHS =	amd64 arm i386
 
 # Must keep version number in sync with lang/cparser
 COMMENT =	graph based intermediate representation and backend
-DISTNAME =	libfirm-1.22.1
+DISTNAME =	${GH_PROJECT}-1.22.1pl1
 CATEGORIES =	devel
 
-SHARED_LIBS +=	firm                      0.0 # 0.0
+SHARED_LIBS +=	firm                      1.0 # 1.0
 
-# amd64 PIC *just* missed 1.22.0; this will go away next update
+# Upstream doesn't make real tarballs. Expects you to use tags/commits.
 GH_ACCOUNT =	libfirm
 GH_PROJECT =	libfirm
-GH_COMMIT =	130099bc8afbca472500e378d927e1251d68bc18
+GH_COMMIT =	eb9c7f9a2a6f28ce0ae94f449ceb9f30a25d939b
 
 HOMEPAGE =	https://pp.ipd.kit.edu/firm/
 MAINTAINER =	Brian Callahan <bcal...@openbsd.org>
@@ -23,18 +23,18 @@ PERMIT_PACKAGE_CDROM =	Yes
 
 WANTLIB += m
 
-# Uncomment next update
-# MASTER_SITES =	https://github.com/libfirm/libfirm/archive/
-
-MODULES =	devel/cmake \
-		lang/python
+MODULES =	lang/python
 MODPY_RUNDEP =	No
+MODPY_ADJ_FILES =	scripts/gen_ir.py
 
-CONFIGURE_ARGS =	-DBUILD_SHARED_LIBS:Bool=On
+CONFIGURE_STYLE =	none
 
-NO_TEST =	Yes
+USE_GMAKE =	Yes
+MAKE_FLAGS =	DLLEXT=".so.${LIBfirm_VERSION}" \
+		REVISION="${GH_COMMIT}" V=1 variant=optimize
 
-# GitHub has silly naming practices. Uncomment next update.
-# WRKDIST =	${WRKDIR}/libfirm-${DISTNAME}
+FAKE_FLAGS =	DESTDIR=
+
+NO_TEST =	Yes
 
 .include <bsd.port.mk>
Index: devel/libfirm/distinfo
===================================================================
RCS file: /cvs/ports/devel/libfirm/distinfo,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 distinfo
--- devel/libfirm/distinfo	6 Nov 2017 01:19:16 -0000	1.1.1.1
+++ devel/libfirm/distinfo	14 Jun 2018 23:45:01 -0000
@@ -1,2 +1,2 @@
-SHA256 (libfirm-1.22.1-130099bc.tar.gz) = XNrCsy8Q+6qfmHIgN0P4hnBOWewC7dsV6xtEYe7HHC4=
-SIZE (libfirm-1.22.1-130099bc.tar.gz) = 1581581
+SHA256 (libfirm-1.22.1pl1-eb9c7f9a.tar.gz) = 9Y/CcZGe/z/wJU4P+NuUCqe8l+rwXgbEUAf/F3SkA0w=
+SIZE (libfirm-1.22.1pl1-eb9c7f9a.tar.gz) = 1614014
Index: devel/libfirm/patches/patch-CMakeLists_txt
===================================================================
RCS file: devel/libfirm/patches/patch-CMakeLists_txt
diff -N devel/libfirm/patches/patch-CMakeLists_txt
--- devel/libfirm/patches/patch-CMakeLists_txt	6 Nov 2017 01:19:16 -0000	1.1.1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: patch-CMakeLists_txt,v 1.1.1.1 2017/11/06 01:19:16 bcallah Exp $
-
-Let CMake do the SHARED_LIBS magic.
-
-Index: CMakeLists.txt
---- CMakeLists.txt.orig
-+++ CMakeLists.txt
-@@ -10,8 +10,6 @@ project(libfirm C)
- set(libfirm_VERSION "1.22.1")
- set(PROJECT_DESCRIPTION "library implementing the intermediate representation Firm")
- 
--set(CMAKE_C_VISIBILITY_PRESET hidden)
--
- set(SOURCES
- 	ir/adt/array.c
- 	ir/adt/bipartite.c
Index: devel/libfirm/patches/patch-Makefile
===================================================================
RCS file: devel/libfirm/patches/patch-Makefile
diff -N devel/libfirm/patches/patch-Makefile
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ devel/libfirm/patches/patch-Makefile	14 Jun 2018 23:45:01 -0000
@@ -0,0 +1,23 @@
+$OpenBSD$
+
+Index: Makefile
+--- Makefile.orig
++++ Makefile
+@@ -38,7 +38,7 @@ endif
+ CFLAGS_debug       = -O0 -g3
+ CFLAGS_profile     = -O3 -pg -fno-inline -DNDEBUG
+ CFLAGS_coverage    = -O0 --coverage
+-CFLAGS_optimize    = -O3 -fomit-frame-pointer -DNDEBUG
++CFLAGS_optimize    = -fomit-frame-pointer -DNDEBUG
+ LINKFLAGS_debug    =
+ LINKFLAGS_profile  = -pg
+ LINKFLAGS_coverage = --coverage
+@@ -156,7 +156,7 @@ $(libfirm_dll): $(libfirm_OBJECTS)
+ # Determine if we can use cparser-beta for quickcheck
+ QUICKCHECK_DEFAULT := $(shell which cparser-beta 2> /dev/null || echo true) -fsyntax-only
+ QUICKCHECK ?= $(QUICKCHECK_DEFAULT)
+-QUICKCHECK_FLAGS ?= -m32 -Wno-compat-option -Wno-shadow -Wno-shadow-local -Wunreachable-code
++QUICKCHECK_FLAGS ?= -Wno-compat-option -Wno-shadow -Wno-shadow-local -Wunreachable-code
+ 
+ $(builddir)/%.o: %.c $(IR_SPEC_GENERATED_INCLUDES)
+ 	@echo CC $@
Index: devel/libfirm/patches/patch-ir_be_amd64_amd64_bearch_c
===================================================================
RCS file: devel/libfirm/patches/patch-ir_be_amd64_amd64_bearch_c
diff -N devel/libfirm/patches/patch-ir_be_amd64_amd64_bearch_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ devel/libfirm/patches/patch-ir_be_amd64_amd64_bearch_c	14 Jun 2018 23:45:01 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+We hereby declare the amd64 backend no longer experimental.
+It compiles the vast majority of OpenBSD C code just fine.
+
+Index: ir/be/amd64/amd64_bearch.c
+--- ir/be/amd64/amd64_bearch.c.orig
++++ ir/be/amd64/amd64_bearch.c
+@@ -774,7 +774,6 @@ static void amd64_init(void)
+ 	amd64_cconv_init();
+ 	x86_set_be_asm_constraint_support(&amd64_asm_constraints);
+ 
+-	ir_target.experimental = "the amd64 backend is experimental and unfinished (consider the ia32 backend)";
+ 	ir_target.fast_unaligned_memaccess = true;
+ 	ir_target.float_int_overflow       = ir_overflow_indefinite;
+ }
Index: devel/libfirm/patches/patch-ir_be_platform_c
===================================================================
RCS file: devel/libfirm/patches/patch-ir_be_platform_c
diff -N devel/libfirm/patches/patch-ir_be_platform_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ devel/libfirm/patches/patch-ir_be_platform_c	14 Jun 2018 23:45:01 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+cparser/libFirm doesn't understand __only_inline.
+This lets us work around it.
+
+Index: ir/be/platform.c
+--- ir/be/platform.c.orig
++++ ir/be/platform.c
+@@ -171,6 +171,7 @@ void ir_platform_set(ir_machine_triple_t const *machin
+ 		goto BSD;
+ 	} else if (strstart(os, "openbsd")) {
+ 		ppdef1("__OpenBSD__");
++		ppdef("_ANSI_LIBRARY", ""); /* avoid __only_inline */
+ 		goto BSD;
+ 	} else if (strstr(os, "bsd") != NULL) {
+ BSD:
Index: devel/libfirm/pkg/PLIST
===================================================================
RCS file: /cvs/ports/devel/libfirm/pkg/PLIST,v
retrieving revision 1.2
diff -u -p -r1.2 PLIST
--- devel/libfirm/pkg/PLIST	20 Jan 2018 09:13:35 -0000	1.2
+++ devel/libfirm/pkg/PLIST	14 Jun 2018 23:45:01 -0000
@@ -11,8 +11,6 @@ include/libfirm/adt/hungarian.h
 include/libfirm/adt/list.h
 include/libfirm/adt/obst.h
 include/libfirm/adt/obstack.h
-include/libfirm/adt/pdeq.h
-include/libfirm/adt/plist.h
 include/libfirm/adt/pmap.h
 include/libfirm/adt/pqueue.h
 include/libfirm/adt/pset.h
@@ -33,7 +31,6 @@ include/libfirm/firm_common.h
 include/libfirm/firm_types.h
 include/libfirm/heights.h
 include/libfirm/ident.h
-include/libfirm/irarch.h
 include/libfirm/ircgopt.h
 include/libfirm/ircons.h
 include/libfirm/irconsconfirm.h
@@ -58,18 +55,14 @@ include/libfirm/irouts.h
 include/libfirm/irprintf.h
 include/libfirm/irprog.h
 include/libfirm/irverify.h
+include/libfirm/jit.h
 include/libfirm/lowering.h
 include/libfirm/nodes.h
 include/libfirm/statev.h
+include/libfirm/target.h
 include/libfirm/timing.h
 include/libfirm/tv.h
 include/libfirm/typerep.h
 include/libfirm/vrp.h
-lib/cmake/
-lib/cmake/libfirm/
-lib/cmake/libfirm/libfirmConfig.cmake
-lib/cmake/libfirm/libfirmConfigVersion.cmake
-lib/cmake/libfirm/libfirmTargets${MODCMAKE_BUILD_SUFFIX}
-lib/cmake/libfirm/libfirmTargets.cmake
+lib/libfirm.a
 @lib lib/libfirm.so.${LIBfirm_VERSION}
-lib/pkgconfig/libfirm.pc
Index: lang/cparser/Makefile
===================================================================
RCS file: /cvs/ports/lang/cparser/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makefile
--- lang/cparser/Makefile	6 Nov 2017 01:21:07 -0000	1.1.1.1
+++ lang/cparser/Makefile	14 Jun 2018 23:45:01 -0000
@@ -5,13 +5,13 @@ ONLY_FOR_ARCHS =	amd64 arm i386
 
 # Must keep version number in sync with devel/libfirm
 COMMENT =	C99 parser and frontend for libFirm
-DISTNAME =	cparser-1.22.1
+DISTNAME =	${GH_PROJECT}-1.22.1pl1
 CATEGORIES =	lang
 
-# amd64 PIC *just* missed 1.22.0; this goes away next update
+# Upstream expects you to use tags.
 GH_ACCOUNT =	libfirm
 GH_PROJECT =	cparser
-GH_COMMIT =	1930dff97172e8199c0d6f452f59dee47569d594
+GH_COMMIT =	62acdfe4b7897b2107246376667e09fc30f84a76
 
 HOMEPAGE =	https://pp.ipd.kit.edu/firm/
 MAINTAINER =	Brian Callahan <bcal...@openbsd.org>
@@ -19,18 +19,16 @@ MAINTAINER =	Brian Callahan <bcallah@ope
 # GPLv2+
 PERMIT_PACKAGE_CDROM =	Yes
 
-WANTLIB += c firm m
+WANTLIB += c firm
 
-# Uncomment next update
-# MASTER_SITES =	https://github.com/libfirm/cparser/archive/
+LIB_DEPENDS =	devel/libfirm
 
-MODULES =	devel/cmake
+USE_GMAKE =	Yes
+MAKE_FLAGS =	FIRM_LIBS="-L${LOCALBASE}/lib -lfirm" \
+		REVISION="${GH_COMMIT}" V=1 variant=optimize
 
-LIB_DEPENDS =	devel/libfirm
+FAKE_FLAGS =	DESTDIR= MANDIR="${DESTDIR}${PREFIX}/man"
 
 NO_TEST =	Yes
-
-# GitHub has silly naming practices. Uncomment next update.
-# WRKDIST =	${WRKDIR}/cparser-${DISTNAME}
 
 .include <bsd.port.mk>
Index: lang/cparser/distinfo
===================================================================
RCS file: /cvs/ports/lang/cparser/distinfo,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 distinfo
--- lang/cparser/distinfo	6 Nov 2017 01:21:07 -0000	1.1.1.1
+++ lang/cparser/distinfo	14 Jun 2018 23:45:01 -0000
@@ -1,2 +1,2 @@
-SHA256 (cparser-1.22.1-1930dff9.tar.gz) = Q4Qul3xeLp96daMOxjoUeGRqacclBNJBlMn1SDmOTKI=
-SIZE (cparser-1.22.1-1930dff9.tar.gz) = 289387
+SHA256 (cparser-1.22.1pl1-62acdfe4.tar.gz) = ylh0xUKn74IPnDeYgL+v1qXGqJlA6n2ZleBBNTmbBVQ=
+SIZE (cparser-1.22.1pl1-62acdfe4.tar.gz) = 291674
Index: lang/cparser/patches/patch-CMakeLists_txt
===================================================================
RCS file: lang/cparser/patches/patch-CMakeLists_txt
diff -N lang/cparser/patches/patch-CMakeLists_txt
--- lang/cparser/patches/patch-CMakeLists_txt	6 Nov 2017 01:21:07 -0000	1.1.1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,14 +0,0 @@
-$OpenBSD: patch-CMakeLists_txt,v 1.1.1.1 2017/11/06 01:21:07 bcallah Exp $
-
-Install manual page correctly.
-
-Index: CMakeLists.txt
---- CMakeLists.txt.orig
-+++ CMakeLists.txt
-@@ -118,5 +118,5 @@ set(INSTALL_HEADERS
- 	include/stddef.h
- )
- install(FILES ${INSTALL_HEADERS} DESTINATION ${COMPILER_INCLUDE_DIR})
--install(FILES cparser.1 DESTINATION share/man/man1)
-+install(FILES cparser.1 DESTINATION man/man1)
- install(TARGETS cparser DESTINATION bin)
Index: lang/cparser/patches/patch-Makefile
===================================================================
RCS file: lang/cparser/patches/patch-Makefile
diff -N lang/cparser/patches/patch-Makefile
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ lang/cparser/patches/patch-Makefile	14 Jun 2018 23:45:01 -0000
@@ -0,0 +1,23 @@
+$OpenBSD$
+
+Index: Makefile
+--- Makefile.orig
++++ Makefile
+@@ -34,7 +34,7 @@ endif
+ 
+ CPPFLAGS := $(CPPFLAGS) $(FIRM_CPPFLAGS)
+ 
+-CFLAGS += -Wall -W -Wstrict-prototypes -Wmissing-prototypes
++CFLAGS += -Wall -W -Wstrict-prototypes -Wmissing-prototypes -I${LOCALBASE}/include
+ # With -std=c99 we get __STRICT_ANSI__ which disables all posix declarations
+ # in cygwin, regardless of a set POSIX_C_SOURCE feature test macro.
+ ifneq ($(filter %cygwin %mingw32, $(shell $(CC) $(CFLAGS) -dumpmachine)),)
+@@ -43,7 +43,7 @@ else
+ CFLAGS += -std=c99 -pedantic
+ endif
+ CFLAGS_debug    = -O0 -g
+-CFLAGS_optimize = -O3 -fomit-frame-pointer -DNDEBUG -DNO_DEFAULT_VERIFY
++CFLAGS_optimize = -fomit-frame-pointer -DNDEBUG -DNO_DEFAULT_VERIFY
+ CFLAGS_profile  = -pg -O3 -fno-inline
+ CFLAGS_coverage = --coverage -O0
+ CFLAGS += $(CFLAGS_$(variant))
Index: lang/cparser/patches/patch-src_driver_predefs_c
===================================================================
RCS file: lang/cparser/patches/patch-src_driver_predefs_c
diff -N lang/cparser/patches/patch-src_driver_predefs_c
--- lang/cparser/patches/patch-src_driver_predefs_c	6 Nov 2017 01:21:07 -0000	1.1.1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,25 +0,0 @@
-$OpenBSD: patch-src_driver_predefs_c,v 1.1.1.1 2017/11/06 01:21:07 bcallah Exp $
-
-cparser doesn't understand __attribute__((__gnu_inline__)).
-This causes all sorts of multiple definition linker errors.
-So let's set the GCC compatibility to too old for it.
-
-Also doesn't understand _Pragma.
-Let's say we're GCC 3.4.6 (for now) because of all this.
-
-Index: src/driver/predefs.c
---- src/driver/predefs.c.orig
-+++ src/driver/predefs.c
-@@ -245,9 +245,9 @@ void add_predefined_macros(void)
- 	add_define("__CPARSER_PATCHLEVEL__", CPARSER_PATCHLEVEL, false);
- 
- 	/* let's pretend we are a GCC compiler */
--	add_define("__GNUC__",            "4", false);
--	add_define("__GNUC_MINOR__",      "6", false);
--	add_define("__GNUC_PATCHLEVEL__", "0", false);
-+	add_define("__GNUC__",            "3", false);
-+	add_define("__GNUC_MINOR__",      "4", false);
-+	add_define("__GNUC_PATCHLEVEL__", "6", false);
- 	if (dialect.cpp)
- 		add_define("__GNUG__", "4", false);
- 
Index: lang/cparser/patches/patch-src_driver_target_c
===================================================================
RCS file: /cvs/ports/lang/cparser/patches/patch-src_driver_target_c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-src_driver_target_c
--- lang/cparser/patches/patch-src_driver_target_c	6 Nov 2017 01:21:07 -0000	1.1.1.1
+++ lang/cparser/patches/patch-src_driver_target_c	14 Jun 2018 23:45:01 -0000
@@ -5,23 +5,15 @@ Add OpenBSD and set it up properly.
 Index: src/driver/target.c
 --- src/driver/target.c.orig
 +++ src/driver/target.c
-@@ -288,6 +288,10 @@ static void set_options_for_machine(machine_triple_t c
- 	} else if (strstr(os, "bsd") != NULL) {
- 		init_generic_elf();
- 		init_unix();
-+#if defined(__OpenBSD__)
-+		target.pic_mode = 1;
-+		ppdef( "__OpenBSD__", "1");
-+#endif
- 	} else if (streq(os, "elf") || streq(os, "octopos") || streq(os, "irtss")) {
- 		init_generic_elf();
- 	} else if (strstart(os, "darwin")) {
-@@ -514,6 +518,8 @@ static machine_triple_t *get_host_machine_triple(void)
- 	machine->operating_system = xstrdup("linux-gnu");
- #elif defined(__linux__)
- 	machine->operating_system = xstrdup("linux");
-+#elif defined(__OpenBSD__)
-+	machine->operating_system = xstrdup("bsd");
- #elif defined(__midipix__)
- 	machine->operating_system = xstrdup("midipix");
- #elif defined(__ELF__)
+@@ -245,6 +245,11 @@ void init_firm_target(void)
+ 		errorf(NULL, "Failed to initialize libfirm code generation\n");
+ 		exit(EXIT_FAILURE);
+ 	}
++
++	if (strstart(ir_triple_get_operating_system(target.machine), "openbsd")) {
++		target.pic = true;
++		target.set_pic = true;
++	}
+ }
+ 
+ bool target_setup(void)
Index: lang/cparser/patches/patch-src_driver_warning_h
===================================================================
RCS file: lang/cparser/patches/patch-src_driver_warning_h
diff -N lang/cparser/patches/patch-src_driver_warning_h
--- lang/cparser/patches/patch-src_driver_warning_h	6 Nov 2017 01:21:07 -0000	1.1.1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,18 +0,0 @@
-$OpenBSD: patch-src_driver_warning_h,v 1.1.1.1 2017/11/06 01:21:07 bcallah Exp $
-
-Turn off -Wexperimental by default.
-The entire amd64 backend is considered experimental.
-We don't need a -Wexperimental warning for every single file compiled on amd64.
-
-Index: src/driver/warning.h
---- src/driver/warning.h.orig
-+++ src/driver/warning.h
-@@ -34,7 +34,7 @@ void print_warning_opt_help(void);
- 	M(WARN_ENDIF_LABELS,                  ON,  "endif-labels",                  "Warn whenever an '#else' or an '#endif' are followed by text") \
- 	M(WARN_ENUM_CONVERSION,               ON,  "enum-conversion",               "warn about implicit conversion between different enum types") \
- 	M(WARN_ERROR,                         OFF, "error",                         "Treat warnings as errors") \
--	M(WARN_EXPERIMENTAL,                  ON,  "experimental",                  "Warn if experimental/unstable compiler features are used") \
-+	M(WARN_EXPERIMENTAL,                  OFF, "experimental",                  "Warn if experimental/unstable compiler features are used") \
- 	M(WARN_FATAL_ERRORS,                  OFF, "fatal-errors",                  "First error stops the compilation") \
- 	M(WARN_FLOAT_EQUAL,                   OFF, "float-equal",                   "Warn if floating point values are used in equality comparisons") \
- 	M(WARN_FORMAT,                        ON,  "format",                        "Check printf-style format strings") \

Reply via email to