Skip to content

Commit

Permalink
Improve Cargo build.
Browse files Browse the repository at this point in the history
Also adds support for Android.
  • Loading branch information
metajack committed Sep 4, 2014
1 parent 9967910 commit f4c036d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]

name = "stb_image"
version = "0.1.0"
authors = ["The Servo Project Developers"]

build = "./build.sh"
build = "make -f makefile.cargo"
4 changes: 0 additions & 4 deletions build.sh

This file was deleted.

22 changes: 22 additions & 0 deletions makefile.cargo
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
ifeq (androideabi,$(findstring androideabi,$(TARGET)))

CC := $(TARGET)-gcc
AR := $(TARGET)-ar

else

CC ?= gcc
AR ?= ar

endif

CFLAGS += -fPIC

.PHONY: all
all: $(OUT_DIR)/libstb-image.a

$(OUT_DIR)/stb_image.o: src/stb_image.c
$(CC) $< -o $@ -c $(CFLAGS)

$(OUT_DIR)/libstb-image.a: $(OUT_DIR)/stb_image.o
$(AR) rcs $@ $^

0 comments on commit f4c036d

Please sign in to comment.