From 38b1af14b9252bef95233152b2e216d043d08c38 Mon Sep 17 00:00:00 2001 From: Jack Moffitt Date: Tue, 2 Jun 2015 22:28:35 -0600 Subject: [PATCH 1/2] Use platform specific deps. --- Cargo.toml | 31 +++++---- Makefile.in | 196 ---------------------------------------------------- configure | 9 --- gen.py | 108 ----------------------------- 4 files changed, 16 insertions(+), 328 deletions(-) delete mode 100644 Makefile.in delete mode 100755 configure delete mode 100644 gen.py diff --git a/Cargo.toml b/Cargo.toml index 262398f..7278741 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,38 +10,39 @@ build = "build.rs" libc = "*" [dependencies.geom] - git = "https://github.com/servo/rust-geom" [dependencies.skia] - git = "https://github.com/servo/skia" -[dependencies.x11] - +[target.i686-unknown-linux-gnu.dependencies.x11] version = "1.1.1" features = ["xlib"] -[dependencies.egl] - -git = "https://github.com/servo/rust-egl" - -[dependencies.freetype] +[target.x86_64-unknown-linux-gnu.dependencies.x11] +version = "1.1.1" +features = ["xlib"] +[target.i686-unknown-linux-gnu.dependencies.freetype] git = "https://github.com/servo/rust-freetype" -[dependencies.freetype-sys] +[target.x86_64-unknown-linux-gnu.dependencies.freetype] +git = "https://github.com/servo/rust-freetype" +[target.i686-unknown-linux-gnu.dependencies.freetype-sys] git = "https://github.com/servo/libfreetype2" -[dependencies.core_foundation] +[target.x86_64-unknown-linux-gnu.dependencies.freetype-sys] +git = "https://github.com/servo/libfreetype2" +[target.x86_64-apple-darwin.dependencies.core_foundation] git = "https://github.com/servo/rust-core-foundation" -[dependencies.core_graphics] - +[target.x86_64-apple-darwin.dependencies.core_graphics] git = "https://github.com/servo/rust-core-graphics" -[dependencies.core_text] - +[target.x86_64-apple-darwin.dependencies.core_text] git = "https://github.com/servo/rust-core-text" + +[target.arm-linux-androideabi.dependencies.egl] +git = "https://github.com/servo/rust-egl" diff --git a/Makefile.in b/Makefile.in deleted file mode 100644 index cb73f29..0000000 --- a/Makefile.in +++ /dev/null @@ -1,196 +0,0 @@ -VPATH=%VPATH% - -CC ?= gcc -CXX ?= g++ -CXXFLAGS ?= -AR ?= ar -RUSTC ?= rustc -RUSTFLAGS ?= -EXT_DEPS ?= -RUSTDOC ?= rustdoc -RUSTDOC_FLAGS ?= -RUSTDOC_TARGET ?= doc - -UNAME=$(shell uname) - -ifeq ($(UNAME),Darwin) - OSTYPE=darwin -endif -ifeq ($(UNAME),Linux) - OSTYPE=linux -endif -ifeq ($(CFG_OSTYPE),linux-androideabi) - OSTYPE=android -endif - -MOZALLOC_CPP_SRC = \ - src/memory/mozalloc/mozalloc_abort.cpp \ - src/memory/mozalloc/mozalloc.cpp \ - src/memory/mozalloc/mozalloc_oom.cpp \ - $(NULL) - -AZURE_CPP_SRC = \ - $(addprefix src/gfx/2d/,\ - Blur.cpp \ - DrawEventRecorder.cpp \ - DrawTargetRecording.cpp \ - Factory.cpp \ - ImageScaling.cpp \ - Matrix.cpp \ - PathRecording.cpp \ - RecordedEvent.cpp \ - Rect.cpp \ - Scale.cpp \ - ScaledFontBase.cpp \ - SourceSurfaceRawData.cpp \ - convolver.cpp \ - image_operations.cpp) - -ifneq ($(CFG_CPUTYPE), arm) - AZURE_CPP_SRC += $(addprefix src/gfx/2d/, ImageScalingSSE2.cpp) -endif -AZURE_CPP_SRC += azure-c.cpp - -ifeq ($(CFG_ENABLE_DEBUG_SKIA),1) -CXXFLAGS += \ - -g \ - -DSK_DEBUG \ - -DGR_DEBUG=1 \ - -DGR_GL_LOG_CALLS=1 \ - -DGR_GL_LOG_CALLS_START=1 \ - $(NULL) -else -CXXFLAGS += \ - -O3 \ - -DSK_RELEASE \ - -DGR_RELEASE=1 \ - $(NULL) -endif - -#SSE2 instruction support required. -CXXFLAGS += \ - -fPIC \ - -I$(VPATH)/include \ - -I$(VPATH)/include/mozilla/gfx \ - -I$(VPATH)/include/mozilla/ipc/chromium/src \ - -I$(VPATH)/include/mozilla/xpcom/base \ - -I$(VPATH)/include/mozilla/xpcom/build \ - -I$(VPATH)/include/mozilla/xpcom/glue \ - -I$(VPATH)/include/mozilla/xpcom/string/public \ - -DMOZ_GFX \ - -DNS_ATTR_MALLOC="" -DNS_WARN_UNUSED_RESULT="" \ - $(NULL) - -#SSE2 instruction support required. -ifneq ($(CFG_CPUTYPE), arm) - CXXFLAGS += -msse2 -endif - -AZURE_CPP_SRC += \ - $(addprefix src/gfx/2d/,\ - DrawTargetSkia.cpp \ - PathSkia.cpp \ - SourceSurfaceSkia.cpp) - -CXXFLAGS += \ - -iquote $(VPATH)/../../skia/skia/include/core \ - -iquote $(VPATH)/../../skia/skia/include/config \ - -iquote $(VPATH)/../../skia/skia/include/effects \ - -iquote $(VPATH)/../../skia/skia/include/ports \ - -iquote $(VPATH)/../../skia/skia/include/utils \ - -iquote $(VPATH)/../../skia/skia/include/gpu \ - -iquote $(VPATH)/../../skia/skia/include/gpu/gl \ - -DUSE_SKIA \ - -DUSE_SKIA_GPU \ - $(NULL) - -USE_CLANG = $(shell $(CXX) --version|grep -c 'clang') - -ifeq ($(USE_CLANG),1) - CXXFLAGS += -Wno-c++11-extensions -endif - -ifeq ($(OSTYPE),darwin) -CXXFLAGS += \ - -DXP_MACOSX \ - -DXP_UNIX \ - -DMALLOC_H="" \ - -I$(VPATH)/include/mozilla/gfx/gl \ - $(NULL) - -AZURE_CPP_SRC += \ - src/gfx/2d/ScaledFontMac.cpp \ - src/gfx/2d/DrawTargetCG.cpp \ - src/gfx/2d/PathCG.cpp \ - src/gfx/2d/SourceSurfaceCG.cpp \ - $(NULL) - -AZURE_OBJCPP_SRC = src/gfx/2d/QuartzSupport.mm -endif - -ifeq ($(OSTYPE),linux) -CXXFLAGS += \ - -DXP_UNIX \ - $(NULL) -AZURE_OBJCPP_SRC = - -CXXFLAGS += -DMOZ_ENABLE_FREETYPE -AZURE_CPP_SRC += \ - $(addprefix src/gfx/2d/,\ - ScaledFontFreetype.cpp) -endif - -ifeq ($(OSTYPE),android) - CXXFLAGS += \ - -DXP_UNIX \ - -DSK_BUILD_FOR_ANDROID \ - $(NULL) - AZURE_OBJCPP_SRC = - - CXXFLAGS += -DMOZ_ENABLE_FREETYPE - AZURE_CPP_SRC += \ - $(addprefix src/gfx/2d/,\ - ScaledFontFreetype.cpp) -endif - -ALL_CPP_SRC = $(MOZALLOC_CPP_SRC) $(AZURE_CPP_SRC) -ALL_OBJCPP_SRC = $(AZURE_OBJCPP_SRC) -ALL_OBJS = $(ALL_CPP_SRC:%.cpp=%.o) $(ALL_OBJCPP_SRC:%.mm=%.o) - -RUST_SRC=$(shell find $(VPATH)/. -type f -name '*.rs') - -.PHONY: all -all: libazure-servo.dummy - -%.o: %.cpp - $(CXX) $< -o $@ -c $(CXXFLAGS) - -%.o: %.mm - $(CXX) -ObjC++ $< -o $@ -c $(CXXFLAGS) - -libazure-servo.dummy: azure.rc $(RUST_SRC) libazure.a $(EXT_DEPS) - $(RUSTC) $(RUSTFLAGS) $< --out-dir . -C extra-filename=-servo - touch $@ - -azure-test: azure.rc $(RUST_SRC) libazure.a - $(RUSTC) $(RUSTFLAGS) $< -o $@ --test - -libazure.a: $(ALL_OBJS) - $(AR) rcs libazure.a $(ALL_OBJS) - -.PHONY: check -check: azure-test - ./azure-test - -.PHONY: doc -doc: $(RUSTDOC_TARGET)/azure/index.html - -$(RUSTDOC_TARGET)/azure/index.html: azure.rc $(RUST_SRC) $(EXT_DEPS) - $(RUSTDOC) $(RUSTDOC_FLAGS) $< -o $(RUSTDOC_TARGET) - -.PHONY: clean -clean: - rm -f azure-test *.o *.a */*/*.o */*/*/*.o *.so *.dylib *.rlib *.dll *.dummy - -../../skia/skia/libskia.a: - cd ../../skia/skia && make diff --git a/configure b/configure deleted file mode 100755 index eca9dbf..0000000 --- a/configure +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -SRCDIR="$(cd $(dirname $0) && pwd)" - -sed -e "s#%VPATH%#${SRCDIR}#" ${SRCDIR}/Makefile.in > Makefile - -mkdir -p src/gfx/2d -mkdir -p src/memory/mozalloc - diff --git a/gen.py b/gen.py deleted file mode 100644 index 3f81462..0000000 --- a/gen.py +++ /dev/null @@ -1,108 +0,0 @@ -# Copyright 2013 The Servo Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -import argparse, subprocess; - -bindgen = "bindgen" - -azure = "azure-c.h" -includes = [ - "-I", "include" - ] -sysincludes = [ - "-isystem", "/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/include", - "-isystem", "/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/include-fixed", - "-isystem", "/usr/lib/gcc/x86_64-linux-gnu/4.6/include", - "-isystem", "/usr/include/cairo", - "-isystem", "/usr/include/freetype2", - ] -otherflags = [ - "-DMOZ_GFX", - "-DUSE_CAIRO", - "-DNS_ATTR_MALLOC=", - "-DNS_WARN_UNUSED_RESULT=" - ] - -args = [ - bindgen, - "-l", "azure", - "-o", "azure.rs", - "-match", "azure-c", - azure] -args += includes + sysincludes + otherflags - -subprocess.call(args) - -cairo = "/usr/include/cairo/cairo.h" -args = [ - bindgen, - "-l", "cairo", - "-o", "cairo.rs", - "-match", "cairo", - cairo] -args += includes + sysincludes - -subprocess.call(args) - -cairo_ft = "/usr/include/cairo/cairo-ft.h" -args = [ - bindgen, - "-l", "cairo", - "-o", "cairo_ft.rs", - "-match", "cairo-ft", - cairo_ft] -args += includes + sysincludes + ["-DCAIRO_HAS_FT_FONT", "-DCAIRO_HAS_FC_FONT"] - -subprocess.call(args) - -cairo_xlib = "/usr/include/cairo/cairo-xlib.h" -args = [ - bindgen, - "-l", "cairo", - "-o", "cairo_xlib.rs", - "-match", "cairo-xlib", - cairo_xlib] -args += includes + sysincludes - -subprocess.call(args) - -ft = "/usr/include/freetype2/freetype/freetype.h" -args = [ - bindgen, - "-l", "freetype", - "-o", "freetype.rs", - "-match", "freetype", - cairo_ft] -args += includes + sysincludes - -subprocess.call(args) - -fc = "/usr/include/fontconfig/fontconfig.h" -args = [ - bindgen, - "-l", "fontconfig", - "-o", "fontconfig.rs", - "-match", "fontconfig", - cairo_ft] -args += includes + sysincludes - -subprocess.call(args) - -xlib = "/usr/include/X11/Xlib.h" -args = [ - bindgen, - "-l", "X11", - "-o", "xlib.rs", - "-match", "Xlib", - "-match", "X", - xlib] -args += includes + sysincludes - -subprocess.call(args) - From 00581e79460edc1c402b92552fc77a28ee7b9097 Mon Sep 17 00:00:00 2001 From: Jack Moffitt Date: Tue, 2 Jun 2015 23:25:42 -0600 Subject: [PATCH 2/2] Warning police. --- src/azure_hl.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/azure_hl.rs b/src/azure_hl.rs index 9083f5b..c2dbeab 100644 --- a/src/azure_hl.rs +++ b/src/azure_hl.rs @@ -5,7 +5,7 @@ //! High-level bindings to Azure. pub use AzColor as Color; -use azure::{AZ_CAP_BUTT, AZ_JOIN_MITER_OR_BEVEL, AZ_FILTER_TYPE_COLOR_MATRIX}; +use azure::{AZ_FILTER_TYPE_COLOR_MATRIX}; use azure::{AZ_FILTER_TYPE_FLOOD, AZ_FILTER_TYPE_GAUSSIAN_BLUR, AZ_FILTER_TYPE_LINEAR_TRANSFER}; use azure::{AZ_FILTER_TYPE_TABLE_TRANSFER, AZ_IN_COLOR_MATRIX_IN, AZ_IN_COMPOSITE_IN}; use azure::{AZ_IN_FLOOD_IN, AZ_IN_GAUSSIAN_BLUR_IN, AZ_IN_LINEAR_TRANSFER_IN}; @@ -24,7 +24,7 @@ use azure::{AzStrokeOptions, AzDrawOptions, AzSurfaceFormat, AzFilter, AzDrawSur use azure::{AzBackendType, AzDrawTargetRef, AzSourceSurfaceRef, AzDataSourceSurfaceRef}; use azure::{AzScaledFontRef, AzGlyphRenderingOptionsRef, AzExtendMode, AzGradientStop}; use azure::{AzCompositionOp, AzAntialiasMode, AzJoinStyle, AzCapStyle}; -use azure::{struct__AzColor, struct__AzGlyphBuffer}; +use azure::{struct__AzGlyphBuffer}; use azure::{struct__AzDrawOptions, struct__AzDrawSurfaceOptions, struct__AzIntSize}; use azure::{struct__AzPoint, struct__AzRect, struct__AzStrokeOptions, struct__AzMatrix5x4}; use azure::{AzCreateColorPattern, AzCreateDrawTarget, AzCreateDrawTargetForData}; @@ -59,13 +59,12 @@ use geom::matrix2d::Matrix2D; use geom::point::Point2D; use geom::rect::Rect; use geom::size::Size2D; -use libc::types::common::c99::{uint8_t, uint16_t}; use libc::size_t; -use skia::{SkiaGrGLNativeContextRef, SkiaGrContextRef}; +use skia::SkiaGrGLNativeContextRef; use skia::{SkiaSkNativeSharedGLContextRef, SkiaSkNativeSharedGLContextCreate}; use skia::{SkiaSkNativeSharedGLContextGetFBOID, SkiaSkNativeSharedGLContextGetGrContext}; use skia::{SkiaSkNativeSharedGLContextRelease, SkiaSkNativeSharedGLContextRetain}; -use skia::{SkiaSkNativeSharedGLContextMakeCurrent, SkiaSkNativeSharedGLContextStealSurface}; +use skia::SkiaSkNativeSharedGLContextMakeCurrent; use skia::{SkiaSkNativeSharedGLContextFlush, SkiaGrGLSharedSurfaceRef}; use std::mem; use std::ptr; @@ -463,7 +462,6 @@ impl DrawTarget { size: Size2D, format: SurfaceFormat) -> DrawTarget { assert!(backend == BackendType::Skia); - let native_surface = native_graphics_context as SkiaGrGLSharedSurfaceRef; let skia_context = unsafe { SkiaSkNativeSharedGLContextCreate(native_graphics_context, size.width, size.height) };