Merge pull request #200 from xdave/master

pvala: removed, useless.
This commit is contained in:
Juan RP 2013-10-28 13:27:21 -07:00
commit f54f3e643a
11 changed files with 331 additions and 452 deletions

View File

@ -1416,3 +1416,4 @@ libxcb-cursor.so.0 xcb-util-cursor-0.1.0_1
libgldi.so.3 libgldi-3.3.1_1
libevdev.so.1 libevdev-0.4_1
libmutter-wayland.so.0 mutter-wayland-3.10.1_1
libgdiplus.so.0 libgdiplus-2.10.9_1

1
srcpkgs/libgdiplus-devel Symbolic link
View File

@ -0,0 +1 @@
libgdiplus

View File

@ -0,0 +1,16 @@
tests/Makefile.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 97f5f4e..c02ca25 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -228,7 +228,7 @@ DEPS = \
$(top_builddir)/src/libgdiplus.la
LDADDS = \
- $(top_builddir)/src/libgdiplus.la
+ $(top_builddir)/src/libgdiplus.la -lX11 -lglib-2.0
testgdi_DEPENDENCIES = $(TEST_DEPS)
testgdi_LDADD = $(LDADDS)

View File

@ -0,0 +1,117 @@
diff --git a/src/gifcodec.c b/src/gifcodec.c
index 8dee0eb..564beed 100644
--- a/src/gifcodec.c
+++ b/src/gifcodec.c
@@ -39,8 +39,10 @@ GUID gdip_gif_image_format_guid = {0xb96b3cb0U, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0
#include "gifcodec.h"
+#if GIFLIB_MAJOR < 5
/* giflib declares this incorrectly as EgifOpen */
extern GifFileType *EGifOpen(void *userData, OutputFunc writeFunc);
+#endif
/* Data structure used for callback */
typedef struct
@@ -105,7 +107,7 @@ gdip_gif_inputfunc (GifFileType *gif, GifByteType *data, int len)
*/
static int
-AddExtensionBlockMono(SavedImage *New, int Len, BYTE ExtData[])
+AddExtensionBlockMono(SavedImage *New, int Len, int func, BYTE ExtData[])
{
ExtensionBlock *ep;
@@ -129,7 +131,7 @@ AddExtensionBlockMono(SavedImage *New, int Len, BYTE ExtData[])
if (ExtData) {
memcpy(ep->Bytes, ExtData, Len);
- ep->Function = New->Function;
+ ep->Function = func;
}
return (GIF_OK);
@@ -232,20 +234,20 @@ DGifSlurpMono(GifFileType * GifFile, SavedImage *TrailingExtensions)
}
case EXTENSION_RECORD_TYPE: {
- if (DGifGetExtension(GifFile, &temp_save.Function, &ExtData) == GIF_ERROR) {
+ int func;
+ if (DGifGetExtension(GifFile, &func, &ExtData) == GIF_ERROR) {
return (GIF_ERROR);
}
while (ExtData != NULL) {
/* Create an extension block with our data */
- if (AddExtensionBlockMono(&temp_save, ExtData[0], &ExtData[1]) == GIF_ERROR) {
+ if (AddExtensionBlockMono(&temp_save, func, ExtData[0], &ExtData[1]) == GIF_ERROR) {
return (GIF_ERROR);
}
if (DGifGetExtensionNext(GifFile, &ExtData) == GIF_ERROR) {
return (GIF_ERROR);
}
- temp_save.Function = 0;
}
break;
}
@@ -303,12 +305,19 @@ gdip_load_gif_image (void *stream, GpImage **image, BOOL from_file)
result = NULL;
loop_counter = FALSE;
+#if GIFLIB_MAJOR < 5
if (from_file) {
gif = DGifOpen(stream, &gdip_gif_fileinputfunc);
} else {
gif = DGifOpen (stream, &gdip_gif_inputfunc);
}
-
+#else
+ if (from_file)
+ gif = DGifOpen(stream, &gdip_gif_fileinputfunc, NULL);
+ else
+ gif = DGifOpen(stream, &gdip_gif_inputfunc, NULL);
+#endif
+
if (gif == NULL) {
goto error;
}
@@ -660,11 +669,22 @@ gdip_save_gif_image (void *stream, GpImage *image, BOOL from_file)
return InvalidParameter;
}
+#if GIFLIB_MAJOR < 5
if (from_file) {
fp = EGifOpenFileName (stream, 0);
} else {
fp = EGifOpen (stream, gdip_gif_outputfunc);
}
+#else
+ if (from_file)
+ fp = EGifOpenFileName (stream, 0, NULL);
+ else
+ fp = EGifOpen (stream, gdip_gif_outputfunc, NULL);
+#define MakeMapObject GifMakeMapObject
+#define FreeMapObject GifFreeMapObject
+#define QuantizeBuffer GifQuantizeBuffer
+#define BitSize GifBitSize
+#endif
if (!fp) {
return FileNotFound;
@@ -848,8 +868,15 @@ gdip_save_gif_image (void *stream, GpImage *image, BOOL from_file)
Buffer[0] = 1;
Buffer[1] = ptr[0];
Buffer[2] = ptr[1];
+#if GIFLIB_MAJOR < 5
EGifPutExtensionFirst(fp, APPLICATION_EXT_FUNC_CODE, 11, "NETSCAPE2.0");
EGifPutExtensionLast(fp, APPLICATION_EXT_FUNC_CODE, 3, Buffer);
+#else
+ EGifPutExtensionLeader(fp, APPLICATION_EXT_FUNC_CODE);
+ EGifPutExtensionBlock(fp, 11, "NETSCAPE2.0");
+ EGifPutExtensionBlock(fp, 3, Buffer);
+ EGifPutExtensionTrailer(fp);
+#endif
}
}

View File

@ -0,0 +1,164 @@
$NetBSD: patch-aa,v 1.8 2011/01/21 10:21:51 wiz Exp $
Fix build with png-1.5.
--- a/src/pngcodec.c.orig 2010-11-03 16:52:54.000000000 +0000
+++ b/src/pngcodec.c
@@ -116,10 +116,15 @@ gdip_load_png_properties (png_structp pn
bitmap_data->dpi_horz = png_get_x_pixels_per_inch(png_ptr, info_ptr);
bitmap_data->dpi_vert = png_get_y_pixels_per_inch(png_ptr, info_ptr);
#elif defined(PNG_pHYs_SUPPORTED)
- if ((info_ptr->valid & PNG_INFO_pHYs) && (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)) {
- bitmap_data->image_flags |= ImageFlagsHasRealDPI;
- bitmap_data->dpi_horz = info_ptr->x_pixels_per_unit * 0.0254;
- bitmap_data->dpi_vert = info_ptr->y_pixels_per_unit * 0.0254;
+ if (png_get_valid (png_ptr, info_ptr, PNG_INFO_pHYs)) {
+ png_uint_32 res_x, res_y;
+ int unit_type;
+ png_get_pHYs (png_ptr, info_ptr, &res_x, &res_y, &unit_type);
+ if (unit_type == PNG_RESOLUTION_METER) {
+ bitmap_data->image_flags |= ImageFlagsHasRealDPI;
+ bitmap_data->dpi_horz = res_x * 0.0254;
+ bitmap_data->dpi_vert = res_y * 0.0254;
+ }
}
#endif
/* default to screen resolution (if nothing was provided or available) */
@@ -130,7 +135,7 @@ gdip_load_png_properties (png_structp pn
#if defined(PNG_iCCP_SUPPORTED)
{
png_charp name;
- png_charp profile;
+ png_bytep profile;
png_uint_32 proflen;
int compression_type;
@@ -292,6 +297,11 @@ gdip_load_png_image_from_file_or_stream
ImageFlags colourspace_flag;
int i;
int j;
+ png_colorp png_palette;
+ int png_num_palette;
+ png_bytep trans_alpha;
+ int num_trans;
+ png_color_16p trans_color;
width = png_get_image_width (png_ptr, info_ptr);
height = png_get_image_height (png_ptr, info_ptr);
@@ -309,6 +319,8 @@ gdip_load_png_image_from_file_or_stream
}
/* Copy palette. */
+ png_get_PLTE (png_ptr, info_ptr, &png_palette, &png_num_palette);
+
num_colours = 1 << bit_depth;
if (png_get_color_type (png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY) {
@@ -321,8 +333,8 @@ gdip_load_png_image_from_file_or_stream
colourspace_flag = ImageFlagsColorSpaceRGB;
palette_entries = num_colours;
- if (palette_entries > info_ptr->num_palette) {
- palette_entries = info_ptr->num_palette;
+ if (palette_entries > png_num_palette) {
+ palette_entries = png_num_palette;
}
palette = GdipAlloc (sizeof(ColorPalette) + (num_colours - 1) * sizeof(ARGB));
@@ -331,29 +343,30 @@ gdip_load_png_image_from_file_or_stream
for (i=0; i < palette_entries; i++) {
set_pixel_bgra (&palette->Entries[i], 0,
- info_ptr->palette[i].blue,
- info_ptr->palette[i].green,
- info_ptr->palette[i].red,
+ png_palette[i].blue,
+ png_palette[i].green,
+ png_palette[i].red,
0xFF); /* alpha */
}
}
+ png_get_tRNS (png_ptr, info_ptr, &trans_alpha, &num_trans, &trans_color);
/* Make sure transparency is respected. */
- if (info_ptr->num_trans > 0) {
+ if (num_trans > 0) {
palette->Flags |= PaletteFlagsHasAlpha;
colourspace_flag |= ImageFlagsHasAlpha;
- if (info_ptr->num_trans > info_ptr->num_palette) {
- info_ptr->num_trans = info_ptr->num_palette;
+ if (num_trans > png_num_palette) {
+ num_trans = png_num_palette;
}
- for (i=0; i < info_ptr->num_trans; i++) {
+ for (i=0; i < num_trans; i++) {
set_pixel_bgra(&palette->Entries[i], 0,
- info_ptr->palette[i].blue,
- info_ptr->palette[i].green,
- info_ptr->palette[i].red,
+ png_palette[i].blue,
+ png_palette[i].green,
+ png_palette[i].red,
#if PNG_LIBPNG_VER > 10399
- info_ptr->trans_alpha [i]); /* alpha */
+ trans_alpha [i]); /* alpha */
#else
info_ptr->trans[i]); /* alpha */
#endif
@@ -398,6 +411,8 @@ gdip_load_png_image_from_file_or_stream
BYTE bit_depth;
int stride;
int interlace;
+ png_colorp png_palette;
+ int png_num_palette;
png_bytep *row_pointers;
BYTE *rawptr;
int i, j;
@@ -490,32 +505,33 @@ gdip_load_png_image_from_file_or_stream
png_byte palette = 0;
png_byte pix = *rowp++;
+ png_get_PLTE (png_ptr, info_ptr, &png_palette, &png_num_palette);
palette = (pix >> 6) & 0x03;
set_pixel_bgra (rawptr, 0,
- info_ptr->palette[palette].blue,
- info_ptr->palette[palette].green,
- info_ptr->palette[palette].red,
+ png_palette[palette].blue,
+ png_palette[palette].green,
+ png_palette[palette].red,
0xFF); /* alpha */
palette = (pix >> 4) & 0x03;
set_pixel_bgra (rawptr, 4,
- info_ptr->palette[palette].blue,
- info_ptr->palette[palette].green,
- info_ptr->palette[palette].red,
+ png_palette[palette].blue,
+ png_palette[palette].green,
+ png_palette[palette].red,
0xFF); /* alpha */
palette = (pix >> 2) & 0x03;
set_pixel_bgra (rawptr, 8,
- info_ptr->palette[palette].blue,
- info_ptr->palette[palette].green,
- info_ptr->palette[palette].red,
+ png_palette[palette].blue,
+ png_palette[palette].green,
+ png_palette[palette].red,
0xFF); /* alpha */
palette = pix & 0x03;
set_pixel_bgra (rawptr, 12,
- info_ptr->palette[palette].blue,
- info_ptr->palette[palette].green,
- info_ptr->palette[palette].red,
+ png_palette[palette].blue,
+ png_palette[palette].green,
+ png_palette[palette].red,
0xFF); /* alpha */
rawptr += 16;
}

View File

@ -0,0 +1,32 @@
# Template file for 'libgdiplus'
pkgname=libgdiplus
version=2.10.9
revision=1
build_style=gnu-configure
configure_args="--with-cairo=system"
hostmakedepends="pkg-config"
makedepends="tiff-devel cairo-devel giflib-devel glib-devel libexif-devel
libpng-devel"
patch_args="-Np1"
short_desc="An Open Source Implementation of the GDI+ API"
maintainer="davehome <davehome@redthumb.info.tm>"
homepage="http://www.go-mono.org"
license="LGPL-2, MPL"
distfiles="http://download.mono-project.com/sources/${pkgname}/$pkgname-$version.tar.bz2"
checksum=6ddeb6c327bada7cb6e06d1a20714f526a0c69520dfd42c12ddd032c3c5d964e
libgdiplus_package() {
pkg_install() {
vmove "usr/lib/*.so.*"
}
}
libgdiplus-devel_package() {
short_desc+=" - Development files"
depends="libgdiplus>=${version}_${revision}"
pkg_install() {
vmove "usr/lib/*.so"
vmove "usr/lib/*.a"
vmove usr/lib/pkgconfig
}
}

View File

@ -1,13 +0,0 @@
diff --git a/configure.ac b/configure.ac
index ff46b0d..be89c11 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,7 +6,7 @@ AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.11 dist-bzip2])
AM_MAINTAINER_MODE([enable])
-VALA_VERSION=0.20
+VALA_VERSION=0.22
PACKAGE_SUFFIX=-$VALA_VERSION
dnl http://people.gnome.org/~walters/docs/build-api.txt

View File

@ -1,41 +0,0 @@
# Template file for 'pvala-codegen-posix'
pkgname=pvala-codegen-posix
version=20130929
revision=2
build_style=gnu-configure
_common_dir="/usr/libexec/vala"
configure_args="--prefix=${_common_dir} --bindir=${_common_dir}
--libdir=${_common_dir}"
hostmakedepends="autoconf automake libtool pkg-config git pvala"
makedepends="libglib-devel pvala-devel"
short_desc="Posix profile plugin for pvala"
maintainer="davehome <davehome@redthumb.info.tm"
homepage="https://gitorious.org/ideas/vala-codegen-posix"
license="LGPL-2.1"
long_desc="
The return of the POSIX profile for Vala (only works with pvala package)."
do_fetch() {
local url="git://gitorious.org/ideas/vala-codegen-posix.git"
local _patch="${FILESDIR}/vala-codegen-posix.patch"
msg_normal "Fetching source from $url ...\n"
git clone ${url} ${pkgname}-${version}
msg_normal "Applying ${_patch} ...\n"
cd "${pkgname}-${version}" && git apply ${_patch}
}
pre_configure() {
./autogen.sh
}
post_install() {
local _file="posix-types.vapi"
vinstall ${wrksrc}/vapi/${_file} 644 usr/share/vala/vapi ${_file}
}
pvala-codegen-posix_package() {
depends="pvala>=0"
pkg_install() {
vmove all
}
}

View File

@ -1 +0,0 @@
pvala

View File

@ -1,332 +0,0 @@
diff --git a/compiler/Makefile.am b/compiler/Makefile.am
index d6e7f81..fc25be4 100644
--- a/compiler/Makefile.am
+++ b/compiler/Makefile.am
@@ -7,7 +7,9 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/vala \
-I$(top_srcdir)/codegen \
$(GLIB_CFLAGS) \
+ $(GMODULE_CFLAGS) \
-DPACKAGE_DATADIR=\"$(pkgdatadir)\" \
+ -DPACKAGE_LIBEXECDIR=\"$(pkglibexecdir)\" \
$(NULL)
BUILT_SOURCES = valac.vala.stamp
@@ -26,12 +28,13 @@ valac_SOURCES = \
$(NULL)
valac.vala.stamp: $(valac_VALASOURCES)
- $(VALA_V)$(VALAC) $(COVERAGE_VALAFLAGS) $(VALAFLAGS) -C --vapidir $(srcdir)/../vapi --pkg gobject-2.0 --vapidir $(srcdir)/../gee --pkg gee --vapidir $(srcdir)/../ccode --pkg ccode --vapidir $(srcdir)/../vala --pkg vala --vapidir $(srcdir)/../codegen --pkg codegen --pkg config $^
+ $(VALA_V)$(VALAC) $(COVERAGE_VALAFLAGS) $(VALAFLAGS) -C --vapidir $(srcdir)/../vapi --pkg gobject-2.0 --pkg gmodule-2.0 --vapidir $(srcdir)/../gee --pkg gee --vapidir $(srcdir)/../ccode --pkg ccode --vapidir $(srcdir)/../vala --pkg vala --vapidir $(srcdir)/../codegen --pkg codegen --pkg config $^
@touch $@
valac_LDADD = \
$(COVERAGE_LIBS) \
$(GLIB_LIBS) \
+ $(GMODULE_LIBS) \
../codegen/libvala@PACKAGE_SUFFIX@.la \
$(NULL)
diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala
index 174794e..af645d0 100644
--- a/compiler/valacompiler.vala
+++ b/compiler/valacompiler.vala
@@ -70,6 +70,8 @@ class Vala.Compiler {
static string cc_command;
[CCode (array_length = false, array_null_terminated = true)]
static string[] cc_options;
+ [CCode (array_length = false, array_null_terminated = true)]
+ static string[] profile_plugin_options;
static string dump_tree;
static bool save_temps;
[CCode (array_length = false, array_null_terminated = true)]
@@ -77,6 +79,7 @@ class Vala.Compiler {
static bool quiet_mode;
static bool verbose_mode;
static string profile;
+ static string profile_plugindir;
static bool nostdpkg;
static bool enable_version_header;
static bool disable_version_header;
@@ -89,6 +92,12 @@ class Vala.Compiler {
private CodeContext context;
+ private Module? profile_module;
+ private CustomProfileFactoryDelegate custom_profile_factory;
+
+ [CCode(has_target=false)]
+ private delegate Vala.CodeGenerator CustomProfileFactoryDelegate(Vala.CodeContext context, string[] profile_plugindir_options);
+
const OptionEntry[] options = {
{ "vapidir", 0, 0, OptionArg.FILENAME_ARRAY, ref vapi_directories, "Look for package bindings in DIRECTORY", "DIRECTORY..." },
{ "girdir", 0, 0, OptionArg.FILENAME_ARRAY, ref gir_directories, "Look for .gir files in DIRECTORY", "DIRECTORY..." },
@@ -132,6 +141,8 @@ class Vala.Compiler {
{ "dump-tree", 0, 0, OptionArg.FILENAME, ref dump_tree, "Write code tree to FILE", "FILE" },
{ "save-temps", 0, 0, OptionArg.NONE, ref save_temps, "Keep temporary files", null },
{ "profile", 0, 0, OptionArg.STRING, ref profile, "Use the given profile instead of the default", "PROFILE" },
+ { "profile-plugindir", 0, 0, OptionArg.STRING, ref profile_plugindir, "Directory used to search for profile plugins", "DIRECTORY" },
+ { "profile-option", 0, 0, OptionArg.STRING_ARRAY, ref profile_plugin_options, "Pass OPTION to the profile plugin", "OPTION" },
{ "quiet", 'q', 0, OptionArg.NONE, ref quiet_mode, "Do not print messages to the console", null },
{ "verbose", 'v', 0, OptionArg.NONE, ref verbose_mode, "Print additional messages to the console", null },
{ "target-glib", 0, 0, OptionArg.STRING, ref target_glib, "Target version of glib for code generation", "MAJOR.MINOR" },
@@ -212,12 +223,34 @@ class Vala.Compiler {
context.thread = thread;
context.mem_profiler = mem_profiler;
context.save_temps = save_temps;
+
+ if (profile_plugindir == null) {
+ profile_plugindir = Config.PACKAGE_LIBEXECDIR;
+ }
if (profile == "gobject-2.0" || profile == "gobject" || profile == null) {
// default profile
context.profile = Profile.GOBJECT;
context.add_define ("GOBJECT");
} else {
- Report.error (null, "Unknown profile %s".printf (profile));
+ if (Module.supported()) {
+ string path = Module.build_path (profile_plugindir, "%s%s".printf(profile, Config.PACKAGE_SUFFIX));
+
+ profile_module = Module.open (path, ModuleFlags.BIND_LOCAL);
+ if (profile_module != null) {
+ void* codegen_factory_func;
+
+ if (profile_module.symbol("vala_codegenerator_factory", out codegen_factory_func)) {
+ custom_profile_factory = (CustomProfileFactoryDelegate) codegen_factory_func;
+ context.profile = Profile.CUSTOM;
+ } else {
+ Report.error (null, "A valid factory function was not found. Can't use module '%s' for profile %s".printf (path, profile));
+ }
+ } else {
+ Report.error (null, "Can't load module '%s'. Unknown profile %s".printf (path, profile));
+ }
+ } else {
+ Report.error (null, "Unknown profile %s".printf (profile));
+ }
}
nostdpkg |= fast_vapi_filename != null;
context.nostdpkg = nostdpkg;
@@ -248,14 +281,16 @@ class Vala.Compiler {
Report.error (null, "This version of valac only supports GLib 2");
}
- for (int i = 16; i <= glib_minor; i += 2) {
- context.add_define ("GLIB_2_%d".printf (i));
- }
+ if (context.profile != Profile.CUSTOM) {
+ for (int i = 16; i <= glib_minor; i += 2) {
+ context.add_define ("GLIB_2_%d".printf (i));
+ }
- if (!nostdpkg) {
- /* default packages */
- context.add_external_package ("glib-2.0");
- context.add_external_package ("gobject-2.0");
+ if (!nostdpkg) {
+ /* default packages */
+ context.add_external_package ("glib-2.0");
+ context.add_external_package ("gobject-2.0");
+ }
}
if (packages != null) {
@@ -280,7 +315,16 @@ class Vala.Compiler {
return quit ();
}
- context.codegen = new GDBusServerModule ();
+ if (context.profile == Profile.CUSTOM) {
+ var codegen = custom_profile_factory(context, profile_plugin_options) as Vala.CodeGenerator;
+ if (codegen != null) {
+ context.codegen = codegen;
+ } else {
+ Report.error (null, "Invalid code generator for profile %s".printf (profile));
+ }
+ } else {
+ context.codegen = new GDBusServerModule ();
+ }
bool has_c_files = false;
diff --git a/vala/valaarraytype.vala b/vala/valaarraytype.vala
index b376723..7431078 100644
--- a/vala/valaarraytype.vala
+++ b/vala/valaarraytype.vala
@@ -165,12 +165,12 @@ public class Vala.ArrayType : ReferenceType {
public override bool compatible (DataType target_type) {
if (target_type.data_type != null) {
- if (target_type.data_type.is_subtype_of (CodeContext.get ().analyzer.gvalue_type.data_type) && element_type.data_type == CodeContext.get ().root.scope.lookup ("string")) {
+ if (CodeContext.get ().analyzer.gvalue_type != null && target_type.data_type.is_subtype_of (CodeContext.get ().analyzer.gvalue_type.data_type) && element_type.data_type == CodeContext.get ().root.scope.lookup ("string")) {
// allow implicit conversion from string[] to GValue
return true;
}
- if (target_type.data_type.is_subtype_of (CodeContext.get ().analyzer.gvariant_type.data_type)) {
+ if (CodeContext.get ().analyzer.gvariant_type != null && target_type.data_type.is_subtype_of (CodeContext.get ().analyzer.gvariant_type.data_type)) {
// allow implicit conversion to GVariant
return true;
}
diff --git a/vala/valacastexpression.vala b/vala/valacastexpression.vala
index c7a72b6..90371b8 100644
--- a/vala/valacastexpression.vala
+++ b/vala/valacastexpression.vala
@@ -163,7 +163,7 @@ public class Vala.CastExpression : Expression {
}
bool is_gvariant (CodeContext context, DataType type) {
- return type.data_type != null && type.data_type.is_subtype_of (context.analyzer.gvariant_type.data_type);
+ return type.data_type != null && context.analyzer.gvariant_type != null && type.data_type.is_subtype_of (context.analyzer.gvariant_type.data_type);
}
public override void emit (CodeGenerator codegen) {
diff --git a/vala/valacodecontext.vala b/vala/valacodecontext.vala
index afad107..62fb4d4 100644
--- a/vala/valacodecontext.vala
+++ b/vala/valacodecontext.vala
@@ -412,9 +412,11 @@ public class Vala.CodeContext {
source_file.relative_filename = filename;
// import the GLib namespace by default (namespace of backend-specific standard library)
- var ns_ref = new UsingDirective (new UnresolvedSymbol (null, "GLib", null));
- source_file.add_using_directive (ns_ref);
- root.add_using_directive (ns_ref);
+ if (this.profile != Profile.CUSTOM) {
+ var ns_ref = new UsingDirective (new UnresolvedSymbol (null, "GLib", null));
+ source_file.add_using_directive (ns_ref);
+ root.add_using_directive (ns_ref);
+ }
add_source_file (source_file);
} else if (filename.has_suffix (".vapi") || filename.has_suffix (".gir")) {
diff --git a/vala/valadatatype.vala b/vala/valadatatype.vala
index 085d321..02ac63c 100644
--- a/vala/valadatatype.vala
+++ b/vala/valadatatype.vala
@@ -263,12 +263,12 @@ public abstract class Vala.DataType : CodeNode {
}
if (target_type.data_type != null) {
- if (target_type.data_type.is_subtype_of (CodeContext.get ().analyzer.gvalue_type.data_type)) {
+ if (CodeContext.get ().analyzer.gvalue_type != null && target_type.data_type.is_subtype_of (CodeContext.get ().analyzer.gvalue_type.data_type)) {
// allow implicit conversion to GValue
return true;
}
- if (target_type.data_type.is_subtype_of (CodeContext.get ().analyzer.gvariant_type.data_type)) {
+ if (CodeContext.get ().analyzer.gvariant_type != null && target_type.data_type.is_subtype_of (CodeContext.get ().analyzer.gvariant_type.data_type)) {
// allow implicit conversion to GVariant
return true;
}
diff --git a/vala/valaforeachstatement.vala b/vala/valaforeachstatement.vala
index 8c65222..0b5f1ec 100644
--- a/vala/valaforeachstatement.vala
+++ b/vala/valaforeachstatement.vala
@@ -174,7 +174,7 @@ public class Vala.ForeachStatement : Block {
array_type.inline_allocated = false;
return check_without_iterator (context, collection_type, array_type.element_type);
- } else if (collection_type.compatible (context.analyzer.glist_type) || collection_type.compatible (context.analyzer.gslist_type)) {
+ } else if ((context.analyzer.glist_type != null && collection_type.compatible (context.analyzer.glist_type)) || (context.analyzer.gslist_type != null && collection_type.compatible (context.analyzer.gslist_type))) {
if (collection_type.get_type_arguments ().size != 1) {
error = true;
Report.error (collection.source_reference, "missing type argument for collection");
@@ -182,7 +182,7 @@ public class Vala.ForeachStatement : Block {
}
return check_without_iterator (context, collection_type, collection_type.get_type_arguments ().get (0));
- } else if (collection_type.compatible (context.analyzer.gvaluearray_type)) {
+ } else if (context.analyzer.gvaluearray_type != null && collection_type.compatible (context.analyzer.gvaluearray_type)) {
return check_without_iterator (context, collection_type, context.analyzer.gvalue_type);
} else {
return check_with_iterator (context, collection_type);
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala
index 89d2ba5..eac7136 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -220,7 +220,8 @@ public class Vala.MethodCall : Expression {
CreationMethod base_cm = null;
- if (mtype is ObjectType || call.symbol_reference == context.analyzer.object_type) {
+ //if (mtype is ObjectType || call.symbol_reference == context.analyzer.object_type) {
+ if (mtype is ObjectType || (context.analyzer.object_type != null && call.symbol_reference == context.analyzer.object_type)) {
// constructor chain-up
var cm = context.analyzer.find_current_method () as CreationMethod;
if (cm == null) {
diff --git a/vala/valapointertype.vala b/vala/valapointertype.vala
index 4bfaf34..4f57641 100644
--- a/vala/valapointertype.vala
+++ b/vala/valapointertype.vala
@@ -83,7 +83,7 @@ public class Vala.PointerType : DataType {
return base_type.compatible (target_type);
}
- if (target_type.data_type != null && target_type.data_type.is_subtype_of (CodeContext.get ().analyzer.gvalue_type.data_type)) {
+ if (target_type.data_type != null && CodeContext.get ().analyzer.gvalue_type != null && target_type.data_type.is_subtype_of (CodeContext.get ().analyzer.gvalue_type.data_type)) {
// allow implicit conversion to GValue
return true;
}
diff --git a/vala/valaprofile.vala b/vala/valaprofile.vala
index 8024965..a5aebdb 100644
--- a/vala/valaprofile.vala
+++ b/vala/valaprofile.vala
@@ -21,5 +21,6 @@
*/
public enum Vala.Profile {
- GOBJECT
+ GOBJECT,
+ CUSTOM
}
diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala
index 8244896..c78c513 100644
--- a/vala/valasemanticanalyzer.vala
+++ b/vala/valasemanticanalyzer.vala
@@ -204,22 +204,24 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
unichar_type = new IntegerType (unichar_struct);
}
- var glib_ns = root_symbol.scope.lookup ("GLib");
+ if (context.profile == Profile.GOBJECT) {
+ var glib_ns = root_symbol.scope.lookup ("GLib");
- object_type = (Class) glib_ns.scope.lookup ("Object");
- type_type = new IntegerType ((Struct) glib_ns.scope.lookup ("Type"));
- gvalue_type = new StructValueType ((Struct) glib_ns.scope.lookup ("Value"));
- gvariant_type = new ObjectType ((Class) glib_ns.scope.lookup ("Variant"));
+ object_type = (Class) glib_ns.scope.lookup ("Object");
+ type_type = new IntegerType ((Struct) glib_ns.scope.lookup ("Type"));
+ gvalue_type = new StructValueType ((Struct) glib_ns.scope.lookup ("Value"));
+ gvariant_type = new ObjectType ((Class) glib_ns.scope.lookup ("Variant"));
- glist_type = new ObjectType ((Class) glib_ns.scope.lookup ("List"));
- gslist_type = new ObjectType ((Class) glib_ns.scope.lookup ("SList"));
- garray_type = new ObjectType ((Class) glib_ns.scope.lookup ("Array"));
- gvaluearray_type = new ObjectType ((Class) glib_ns.scope.lookup ("ValueArray"));
+ glist_type = new ObjectType ((Class) glib_ns.scope.lookup ("List"));
+ gslist_type = new ObjectType ((Class) glib_ns.scope.lookup ("SList"));
+ garray_type = new ObjectType ((Class) glib_ns.scope.lookup ("Array"));
+ gvaluearray_type = new ObjectType ((Class) glib_ns.scope.lookup ("ValueArray"));
- gerror_type = (Class) glib_ns.scope.lookup ("Error");
- regex_type = new ObjectType ((Class) root_symbol.scope.lookup ("GLib").scope.lookup ("Regex"));
+ gsource_type = (Class) glib_ns.scope.lookup ("Source");
- gsource_type = (Class) glib_ns.scope.lookup ("Source");
+ gerror_type = (Class) glib_ns.scope.lookup ("Error");
+ regex_type = new ObjectType ((Class) root_symbol.scope.lookup ("GLib").scope.lookup ("Regex"));
+ }
current_symbol = root_symbol;
context.root.check (context);
diff --git a/vapi/config.vapi b/vapi/config.vapi
index 2c6df9e..aada11b 100644
--- a/vapi/config.vapi
+++ b/vapi/config.vapi
@@ -26,4 +26,5 @@ namespace Config {
public const string BUILD_VERSION;
public const string PACKAGE_DATADIR;
public const string PACKAGE_SUFFIX;
+ public const string PACKAGE_LIBEXECDIR;
}

View File

@ -1,65 +0,0 @@
# Template file for 'pvala'
pkgname=pvala
version=20130929
revision=1
build_style=gnu-configure
configure_args="--enable-vapigen"
hostmakedepends="autoconf automake libtool pkg-config flex libxslt git vala"
makedepends="libglib-devel libfl-devel"
short_desc="Compiler for the GObject type system - Profile plugins version"
maintainer="davehome <davehome@redthumb.info.tm"
homepage="http://live.gnome.org/Vala"
license="LGPL-2.1"
long_desc="
Vala is a new programming language that aims to bring modern programming
language features to GNOME developers without imposing any additional runtime
requirements and without using a different ABI compared to applications and
libraries written in C. This version adds an experimental patch that enables
one to provide profile-based code generator plugin modules (ie. the return of
the POSIX profile!)"
do_fetch() {
local url="git://git.gnome.org/vala"
local _patch="${FILESDIR}/valac-profile-plugins.patch"
msg_normal "Fetching source from $url ...\n"
git clone ${url} ${pkgname}-${version}
msg_normal "Applying ${_patch} ...\n"
cd "${pkgname}-${version}" && git apply ${_patch}
}
pre_configure() {
./autogen.sh
}
libpvala_package() {
short_desc+=" - shared library"
replaces="libvala>=0"
provides="libvala-${version}"
pkg_install() {
vmove "usr/lib/*.so.*"
}
}
pvala-devel_package() {
depends="libglib-devel pvala>=${version}"
short_desc+=" - development files"
replaces="vala-devel>=0"
provides="vala-devel-${version}"
pkg_install() {
vmove usr/include
vmove usr/lib/pkgconfig
vmove "usr/lib/*.so"
vmove usr/share/aclocal
vmove usr/share/devhelp
}
}
pvala_package() {
depends="libpvala>=${version}"
replaces="vala>=0"
provides="vala-${version}"
pkg_install() {
vmove all
}
}