From 3d3327ffa257b7b58e6d5c4b83a13d55071720a4 Mon Sep 17 00:00:00 2001 From: joe Date: Wed, 20 Dec 2017 16:30:39 -0500 Subject: Initial commit. --- c2haskell.hs | 169 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 c2haskell.hs diff --git a/c2haskell.hs b/c2haskell.hs new file mode 100644 index 0000000..8397f98 --- /dev/null +++ b/c2haskell.hs @@ -0,0 +1,169 @@ + +import Language.C +import Language.C.System.GCC +import System.Environment +import System.IO + +hack_incs = [ "-I." ] + +-- pkg-config --cflags clutter-1.0 +clutter_incs = + [ "-pthread" + , "-I/usr/include/clutter-1.0" + , "-I/usr/include/cogl" + , "-I/usr/include/atk-1.0" + , "-I/usr/include/cogl" + , "-I/usr/include/libdrm" + , "-I/usr/include/json-glib-1.0" + , "-I/usr/include/gtk-3.0" + , "-I/usr/include/gio-unix-2.0/" + , "-I/usr/include/cairo" + , "-I/usr/include/pango-1.0" + , "-I/usr/include/harfbuzz" + , "-I/usr/include/pango-1.0" + , "-I/usr/include/gdk-pixbuf-2.0" + , "-I/usr/include/libpng16" + , "-I/usr/include/cairo" + , "-I/usr/include/pixman-1" + , "-I/usr/include/freetype2" + , "-I/usr/include/libpng16" + , "-I/usr/include/glib-2.0" + , "-I/usr/lib/x86_64-linux-gnu/glib-2.0/include" + ] + + +-- pkg-config --cflags cogl-pango-2.0-experimental +cogl_pango2_incs = + [ "-D COGL_ENABLE_EXPERIMENTAL_2_0_API" + , "-pthread" + , "-I/usr/include/cogl" + , "-I/usr/include/cairo" + , "-I/usr/include/pixman-1" + , "-I/usr/include/freetype2" + , "-I/usr/include/libpng16" + , "-I/usr/include/gdk-pixbuf-2.0" + , "-I/usr/include/libpng16" + , "-I/usr/include/glib-2.0" + , "-I/usr/lib/x86_64-linux-gnu/glib-2.0/include" + , "-I/usr/include/libdrm" + ] + + +-- pkg-config cogl-pango-1.0 --cflags +cogl_pango_incs = + [ "-pthread" + , "-I/usr/include/cogl" + , "-I/usr/include/cairo" + , "-I/usr/include/pixman-1" + , "-I/usr/include/freetype2" + , "-I/usr/include/libpng16" + , "-I/usr/include/gdk-pixbuf-2.0" + , "-I/usr/include/libpng16" + , "-I/usr/include/glib-2.0" + , "-I/usr/lib/x86_64-linux-gnu/glib-2.0/include" + , "-I/usr/include/libdrm" ] + +-- pkg-config gtk+-3.0 --cflags +gtk_incs = + [ "-pthread" + , "-I/usr/include/gtk-3.0" + , "-I/usr/include/at-spi2-atk/2.0" + , "-I/usr/include/at-spi-2.0" + , "-I/usr/include/dbus-1.0" + , "-I/usr/lib/x86_64-linux-gnu/dbus-1.0/include" + , "-I/usr/include/gtk-3.0" + , "-I/usr/include/gio-unix-2.0/" + , "-I/usr/include/cairo" + , "-I/usr/include/pango-1.0" + , "-I/usr/include/harfbuzz" + , "-I/usr/include/pango-1.0" + , "-I/usr/include/atk-1.0" + , "-I/usr/include/cairo" + , "-I/usr/include/pixman-1" + , "-I/usr/include/freetype2" + , "-I/usr/include/libpng16" + , "-I/usr/include/gdk-pixbuf-2.0" + , "-I/usr/include/libpng16" + , "-I/usr/include/glib-2.0" + , "-I/usr/lib/x86_64-linux-gnu/glib-2.0/include" + ] + +-- pkg-config --cflags gobject-introspection-1.0 +gobj_incs = + [ "-pthread" + , "-I/usr/include/gobject-introspection-1.0" + , "-I/usr/include/glib-2.0" + , "-I/usr/lib/x86_64-linux-gnu/glib-2.0/include" + ] + +-- pkg-config --cflags libmutter-1 +mutter_incs = + [ "-pthread" + , "-I/usr/include/mutter" + , "-I/usr/include/gtk-3.0" + , "-I/usr/include/at-spi2-atk/2.0" + , "-I/usr/include/at-spi-2.0" + , "-I/usr/include/dbus-1.0" + , "-I/usr/lib/x86_64-linux-gnu/dbus-1.0/include" + , "-I/usr/include/gtk-3.0" + , "-I/usr/include/gio-unix-2.0/" + , "-I/usr/include/cairo" + , "-I/usr/include/mutter/clutter-1" + , "-I/usr/include/cairo" + , "-I/usr/include/atk-1.0" + , "-I/usr/include/pango-1.0" + , "-I/usr/include/harfbuzz" + , "-I/usr/include/pango-1.0" + , "-I/usr/include/json-glib-1.0" + , "-I/usr/include/mutter/cogl" + , "-I/usr/include/cairo" + , "-I/usr/include/pixman-1" + , "-I/usr/include/freetype2" + , "-I/usr/include/libpng16" + , "-I/usr/include/gdk-pixbuf-2.0" + , "-I/usr/include/libpng16" + , "-I/usr/include/glib-2.0" + , "-I/usr/lib/x86_64-linux-gnu/glib-2.0/include" + , "-I/usr/include/libdrm" + , "-I/usr/include/gsettings-desktop-schemas" + ] + +-- pkg-config --cflags gjs-1.0 +gjs_incs = + [ "-pthread" + , "-include" + , "/usr/include/mozjs-52/js/RequiredDefines.h" + , "-pthread" + , "-I/usr/include/gobject-introspection-1.0" + , "-I/usr/include/mozjs-52" + , "-I/usr/include/gtk-3.0" + , "-I/usr/include/at-spi2-atk/2.0" + , "-I/usr/include/at-spi-2.0" + , "-I/usr/include/dbus-1.0" + , "-I/usr/lib/x86_64-linux-gnu/dbus-1.0/include" + , "-I/usr/include/gtk-3.0" + , "-I/usr/include/gio-unix-2.0/" + , "-I/usr/include/cairo" + , "-I/usr/include/pango-1.0" + , "-I/usr/include/harfbuzz" + , "-I/usr/include/pango-1.0" + , "-I/usr/include/atk-1.0" + , "-I/usr/include/cairo" + , "-I/usr/include/pixman-1" + , "-I/usr/include/freetype2" + , "-I/usr/include/libpng16" + , "-I/usr/include/gdk-pixbuf-2.0" + , "-I/usr/include/libpng16" + , "-I/usr/include/glib-2.0" + , "-I/usr/lib/x86_64-linux-gnu/glib-2.0/include" + , "-I/usr/include/gjs-1.0" + ] + + +main = do + args <- getArgs + let fname = last args + opts = ["-DGETTEXT_PACKAGE=c2haskell"] ++ init args + incs = "-I." : gjs_incs ++ gobj_incs ++ mutter_incs ++ clutter_incs ++ cogl_pango2_incs ++ gtk_incs + r <- parseCFile (newGCC "gcc") Nothing (incs ++ opts) fname + print (fmap prettyUsingInclude r) -- cgit v1.2.3