From c0c3647bbf64af754d3cc9b6d167c8ca2b736f74 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Sat, 29 Mar 2014 13:02:50 +0100 Subject: update native build --- flow-native/Makefile | 66 ++++++++++++++++++++------------------ flow-native/common.mk | 51 +++++++++++++++++++++++++++++ flow-native/debian/control | 2 +- flow-native/debian/libflow3-0.dirs | 1 + flow-native/debian/libflow3.dirs | 1 - flow-native/readme.md | 3 ++ 6 files changed, 90 insertions(+), 34 deletions(-) create mode 100644 flow-native/common.mk create mode 100644 flow-native/debian/libflow3-0.dirs delete mode 100644 flow-native/debian/libflow3.dirs create mode 100644 flow-native/readme.md (limited to 'flow-native') diff --git a/flow-native/Makefile b/flow-native/Makefile index fb973f3..0a64190 100644 --- a/flow-native/Makefile +++ b/flow-native/Makefile @@ -1,56 +1,58 @@ # Build native binaries for flow. # =============================== +# This makefile is intended for linux based systems. -# name of the library to produce -NAME=flow -MAJOR=3 -MINOR=0 -MICRO=0 +# Include common settings +include common.mk -SONAME=lib$(NAME).so.$(MAJOR) -TARGET=$(SONAME).$(MINOR).$(MICRO) - -JAVA_HOME=/usr/lib/jvm/java-7-oracle +# Name of library to build +LIB=lib$(NAME).so -# where the library should be installed -PREFIX?=usr/lib +# soname of library +SONAME=$(LIB).$(MAJOR) -# compiler and linker settings -CC=$(CROSS_COMPILE)gcc -LD=$(CROSS_COMPILE)ld -CFLAGS= -O2 -fPIC -Wall - -# since java connot easily load a library with a specific -# major version, the vesion is included in the library's name +# Actual file name of library +TARGET=$(SONAME).$(MINOR).$(MICRO) +# Linux-specific linker flags LDFLAGS+=-shared -Wl,-soname,$(SONAME) -INCLUDES=./include/ $(JAVA_HOME)/include/ $(JAVA_HOME)/include/linux/ -OBJECTS=flow_jni.o posix/flow.o +# All final products that should be installed +PRODUCTS=$(TARGET) $(SONAME) $(LIB) -# rules -all: $(TARGET) $(SONAME) +# Build library and all appropriate links +all: $(PRODUCTS) + +# Build actual library $(TARGET): $(OBJECTS) $(CC) $(LDFLAGS) -o $@ $^ - + +# Create soname link $(SONAME): $(TARGET) - ln -s $(TARGET) $(SONAME) + ln -s $< $@ +# Create dev link +$(LIB): $(SONAME) + ln -s $< $@ + +# Compile objects %.o: %.c $(CC) $(CFLAGS) $(addprefix -I, $(INCLUDES)) -o $@ -c $< -install: - cp -P -t $(DESTDIR)/$(PREFIX)/ $(TARGET) $(SONAME) +# Install resulting artifacts +install: all + @for product in $(PRODUCTS); do cp -P -t $(DESTDIR)/$(PREFIX)/lib $${product}; done +# Uninstall resulting artifacts uninstall: - rm $(DESTDIR)/$(PREFIX)/$(TARGET) - rm $(DESTDIR)/$(PREFIX)/$(SONAME) - + @for product in $(PRODUCTS); do rm $(DESTDIR)/$(PREFIX)/lib/$${product}; done + +# Clean build clean: rm -f posix/*.o rm -f posix/*.so - rm -f $(TARGET) - rm -f $(SONAME) + rm -f *.o + $(foreach product, $(PRODUCTS), rm -f $(product);) -.PHONY: clean install +.PHONY: clean install uninstall \ No newline at end of file diff --git a/flow-native/common.mk b/flow-native/common.mk new file mode 100644 index 0000000..be9f980 --- /dev/null +++ b/flow-native/common.mk @@ -0,0 +1,51 @@ +# Common settings for flow native build +# ===================================== + +# Name of the library to produce +# +NAME=flow3 + + +# Library versions +# +# Note that MAJOR should always be set tozero +# since java does not allow loading semantically +# versioned libraries, include the major version +# in the name instead. +# +MAJOR=0# always zero +MINOR=0# backwards-compatible changes +MICRO=0# bugfixes + + +# Directory where the library will be installed +# +PREFIX?=/usr + + +# Compiler and linker settings +# +# Set CROSS_COMPILE to a gcc triplet +# when cross-compiling +# +CC=$(CROSS_COMPILE)gcc +LD=$(CROSS_COMPILE)ld +CFLAGS= -O2 -fPIC -Wall +LDFLAGS= + + +# JDK base directory +# +JAVA_HOME?=/usr/lib/jvm/java-7-oracle + + +# Include directories +# +INCLUDES=./include/ $(JAVA_HOME)/include/ $(JAVA_HOME)/include/linux/ + + +# Objects that will be compiled from respective .c files +# +OBJECTS=flow_jni.o posix/flow.o + + diff --git a/flow-native/debian/control b/flow-native/debian/control index 5fc8b77..dea1f0f 100644 --- a/flow-native/debian/control +++ b/flow-native/debian/control @@ -7,7 +7,7 @@ Section: libs Homepage: https://github.com/jodersky/flow Vcs-Git: git://github.com/jodersky/flow.git -Package: libflow3 +Package: libflow3-0 Section: libs Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} diff --git a/flow-native/debian/libflow3-0.dirs b/flow-native/debian/libflow3-0.dirs new file mode 100644 index 0000000..6845771 --- /dev/null +++ b/flow-native/debian/libflow3-0.dirs @@ -0,0 +1 @@ +usr/lib diff --git a/flow-native/debian/libflow3.dirs b/flow-native/debian/libflow3.dirs deleted file mode 100644 index 6845771..0000000 --- a/flow-native/debian/libflow3.dirs +++ /dev/null @@ -1 +0,0 @@ -usr/lib diff --git a/flow-native/readme.md b/flow-native/readme.md new file mode 100644 index 0000000..86987ed --- /dev/null +++ b/flow-native/readme.md @@ -0,0 +1,3 @@ +# Native backend for flow + +Refer to documentation/building.md for information on how to build. \ No newline at end of file -- cgit v1.2.3