-
audiomobster
I made a patch for the MakefileTemplate to cross compile for Raspbian. I need a little help with the include of m_pd.h, as I have to put it in the build directory.
I hope it's usable as I have already stripped my other changes.
Help appreciated
Uli
@@ -157,8 +158,32 @@ ifeq ($(UNAME),ANDROID) --strip-unneeded -R .note -R .comment DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) endif +# Though Raspberry Pi uses Linux, we use this fake uname to provide an easy way to +# setup all this things needed to cross-compile for Raspberry Pi on Gentoo and maybe +# others +ifeq ($(UNAME),RASPI) + CPU := armv6l + SOURCES += $(SOURCES_linux) + EXTENSION = pd_linux + SHARED_EXTENSION = so + OS = linux + PD_PATH = /usr + RASPI_BASE=/usr/x86_64-pc-linux-gnu/armv6j-hardfloat-linux-gnueabi/gcc-bin/4.5.4 + RASPI_PREFIX=armv6j-hardfloat-linux-gnueabi- + RASPI_STRIP=/usr/libexec/gcc/armv6j-hardfloat-linux-gnueabi + CC=$(RASPI_BASE)/$(RASPI_PREFIX)gcc + CPP=$(RASPI_BASE)/$(RASPI_PREFIX)cpp + CXX=$(RASPI_BASE)/$(RASPI_PREFIX)g++ + OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer + CFLAGS += + LDFLAGS += -rdynamic -shared -fPIC + SHARED_LDFLAGS += -Wl,-soname,$(SHARED_LIB) -shared + LIBS += -lc $(LIBS_linux) + STRIP = $(RASPI_STRIP)/strip --strip-unneeded -R .note -R .comment + DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) +endif ifeq ($(UNAME),Linux) - CPU := $(shell uname -m) + CPU := $(shell uname -m) SOURCES += $(SOURCES_linux) EXTENSION = pd_linux SHARED_EXTENSION = so @@ -448,3 +473,6 @@ showsetup: @echo "NDK_TOOLCHAIN: $(NDK_TOOLCHAIN)" @echo "NDK_BASE: $(NDK_BASE)" @echo "NDK_SYSROOT: $(NDK_SYSROOT)" + @echo "RASPI_BASE: $(RASPI_BASE)" + @echo "RASPI_PREFIX: $(RASPI_PREFIX)" + @echo "RASPI_STRIP: $(RASPI_STRIP)"
-
audiomobster
Hi there,
even in case you want to beat me, I have to ask. Would it be possible to build a commercial pd lib extension for pd?
Regards
Uli
-
audiomobster
Solved the issue with including m_pd.h
@@ -66,7 +66,7 @@ objectsdir = $(pkglibdir) INSTALL = install INSTALL_PROGRAM = $(INSTALL) -p -m 644 -INSTALL_DATA = $(INSTALL) -p -m 644 +INSTALL_DATA = $(INSTALL) -C -m 644 INSTALL_DIR = $(INSTALL) -p -m 755 -d ALLSOURCES := $(SOURCES) $(SOURCES_android) $(SOURCES_cygwin) $(SOURCES_macosx) \ @@ -75,7 +75,7 @@ ALLSOURCES := $(SOURCES) $(SOURCES_andro DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) ORIGDIR=pd-$(LIBRARY_NAME:~=)_$(LIBRARY_VERSION) -UNAME := $(shell uname -s) +UNAME ?= $(shell uname -s) ifeq ($(UNAME),Darwin) CPU := $(shell uname -p) ifeq ($(CPU),arm) # iPhone/iPod Touch @@ -157,8 +157,33 @@ ifeq ($(UNAME),ANDROID) --strip-unneeded -R .note -R .comment DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) endif +# Though Raspberry Pi uses Linux, we use this fake uname to provide an easy way to +# setup all this things needed to cross-compile for Raspberry Pi on Gentoo and maybe +# others +ifeq ($(UNAME),RASPI) + CPU := armv6l + SOURCES += $(SOURCES_linux) + EXTENSION = pd_linux + SHARED_EXTENSION = so + OS = linux + PD_PATH = /usr + PD_INCLUDE = $(PD_PATH)/include + RASPI_BASE=/usr/x86_64-pc-linux-gnu/armv6j-hardfloat-linux-gnueabi/gcc-bin/4.5.4 + RASPI_PREFIX=armv6j-hardfloat-linux-gnueabi- + RASPI_STRIP=/usr/libexec/gcc/armv6j-hardfloat-linux-gnueabi + CC=$(RASPI_BASE)/$(RASPI_PREFIX)gcc + CPP=$(RASPI_BASE)/$(RASPI_PREFIX)cpp + CXX=$(RASPI_BASE)/$(RASPI_PREFIX)g++ + OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer + CFLAGS += -fPIC + LDFLAGS += -rdynamic -shared -fPIC + SHARED_LDFLAGS += -Wl,-soname,$(SHARED_LIB) -shared + LIBS += -lc $(LIBS_linux) + STRIP = $(RASPI_STRIP)/strip --strip-unneeded -R .note -R .comment + DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) +endif ifeq ($(UNAME),Linux) - CPU := $(shell uname -m) + CPU := $(shell uname -m) SOURCES += $(SOURCES_linux) EXTENSION = pd_linux SHARED_EXTENSION = so @@ -448,3 +473,6 @@ showsetup: @echo "NDK_TOOLCHAIN: $(NDK_TOOLCHAIN)" @echo "NDK_BASE: $(NDK_BASE)" @echo "NDK_SYSROOT: $(NDK_SYSROOT)" + @echo "RASPI_BASE: $(RASPI_BASE)" + @echo "RASPI_PREFIX: $(RASPI_PREFIX)" + @echo "RASPI_STRIP: $(RASPI_STRIP)"
-
audiomobster
I want to have a directory/file structure like this:
uli-help.pd uli-meta.pd uli.pd uli.pd_linux
A PD object with the same prefix as my lib, which I think is normal. This wants to copy two times uli-help.pd into the install directory and fails. So I changed the parameter to install. The rest is cosmetics. Patch aginst last patch:
@@ -66,7 +66,7 @@ objectsdir = $(pkglibdir) INSTALL = install INSTALL_PROGRAM = $(INSTALL) -p -m 644 -INSTALL_DATA = $(INSTALL) -p -m 644 +INSTALL_DATA = $(INSTALL) -C -m 644 INSTALL_DIR = $(INSTALL) -p -m 755 -d ALLSOURCES := $(SOURCES) $(SOURCES_android) $(SOURCES_cygwin) $(SOURCES_macosx) \
Patch against revision 16756:
@@ -66,7 +66,7 @@ objectsdir = $(pkglibdir) INSTALL = install INSTALL_PROGRAM = $(INSTALL) -p -m 644 -INSTALL_DATA = $(INSTALL) -p -m 644 +INSTALL_DATA = $(INSTALL) -C -m 644 INSTALL_DIR = $(INSTALL) -p -m 755 -d ALLSOURCES := $(SOURCES) $(SOURCES_android) $(SOURCES_cygwin) $(SOURCES_macosx) \ @@ -75,7 +75,7 @@ ALLSOURCES := $(SOURCES) $(SOURCES_andro DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) ORIGDIR=pd-$(LIBRARY_NAME:~=)_$(LIBRARY_VERSION) -UNAME := $(shell uname -s) +UNAME ?= $(shell uname -s) ifeq ($(UNAME),Darwin) CPU := $(shell uname -p) ifeq ($(CPU),arm) # iPhone/iPod Touch @@ -157,8 +157,32 @@ ifeq ($(UNAME),ANDROID) --strip-unneeded -R .note -R .comment DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) endif +# Though Raspberry Pi uses Linux, we use this fake uname to provide an easy way to +# setup all this things needed to cross-compile for Raspberry Pi on Gentoo and maybe +# others +ifeq ($(UNAME),RASPI) + CPU := armv6l + SOURCES += $(SOURCES_linux) + EXTENSION = pd_linux + SHARED_EXTENSION = so + OS = linux + PD_PATH = /usr + RASPI_BASE=/usr/x86_64-pc-linux-gnu/armv6j-hardfloat-linux-gnueabi/gcc-bin/4.5.4 + RASPI_PREFIX=armv6j-hardfloat-linux-gnueabi- + RASPI_STRIP=/usr/libexec/gcc/armv6j-hardfloat-linux-gnueabi + CC=$(RASPI_BASE)/$(RASPI_PREFIX)gcc + CPP=$(RASPI_BASE)/$(RASPI_PREFIX)cpp + CXX=$(RASPI_BASE)/$(RASPI_PREFIX)g++ + OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer + CFLAGS += -fPIC + LDFLAGS += -rdynamic -shared -fPIC + SHARED_LDFLAGS += -Wl,-soname,$(SHARED_LIB) -shared + LIBS += -lc $(LIBS_linux) + STRIP = $(RASPI_STRIP)/strip --strip-unneeded -R .note -R .comment + DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) +endif ifeq ($(UNAME),Linux) - CPU := $(shell uname -m) + CPU := $(shell uname -m) SOURCES += $(SOURCES_linux) EXTENSION = pd_linux SHARED_EXTENSION = so @@ -448,3 +472,6 @@ showsetup: @echo "NDK_TOOLCHAIN: $(NDK_TOOLCHAIN)" @echo "NDK_BASE: $(NDK_BASE)" @echo "NDK_SYSROOT: $(NDK_SYSROOT)" + @echo "RASPI_BASE: $(RASPI_BASE)" + @echo "RASPI_PREFIX: $(RASPI_PREFIX)" + @echo "RASPI_STRIP: $(RASPI_STRIP)"
-
audiomobster
I advanced the whole thing a bit. Now I can set an "Environment Variable"
UNAME=RASPI
in an "Eclipse Build Configuration" and switch between an Intel and arm build.
@@ -75,7 +75,7 @@ ALLSOURCES := $(SOURCES) $(SOURCES_andro DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) ORIGDIR=pd-$(LIBRARY_NAME:~=)_$(LIBRARY_VERSION) -UNAME := $(shell uname -s) +UNAME?= $(shell uname -s) ifeq ($(UNAME),Darwin) CPU := $(shell uname -p) ifeq ($(CPU),arm) # iPhone/iPod Touch @@ -157,8 +157,32 @@ ifeq ($(UNAME),ANDROID) --strip-unneeded -R .note -R .comment DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) endif +# Though Raspberry Pi uses Linux, we use this fake uname to provide an easy way to +# setup all this things needed to cross-compile for Raspberry Pi on Gentoo and maybe +# others +ifeq ($(UNAME),RASPI) + CPU := armv6l + SOURCES += $(SOURCES_linux) + EXTENSION = pd_linux + SHARED_EXTENSION = so + OS = linux + PD_PATH = /usr + RASPI_BASE=/usr/x86_64-pc-linux-gnu/armv6j-hardfloat-linux-gnueabi/gcc-bin/4.5.4 + RASPI_PREFIX=armv6j-hardfloat-linux-gnueabi- + RASPI_STRIP=/usr/libexec/gcc/armv6j-hardfloat-linux-gnueabi + CC=$(RASPI_BASE)/$(RASPI_PREFIX)gcc + CPP=$(RASPI_BASE)/$(RASPI_PREFIX)cpp + CXX=$(RASPI_BASE)/$(RASPI_PREFIX)g++ + OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer + CFLAGS += -fPIC + LDFLAGS += -rdynamic -shared -fPIC + SHARED_LDFLAGS += -Wl,-soname,$(SHARED_LIB) -shared + LIBS += -lc $(LIBS_linux) + STRIP = $(RASPI_STRIP)/strip --strip-unneeded -R .note -R .comment + DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) +endif ifeq ($(UNAME),Linux) - CPU := $(shell uname -m) + CPU := $(shell uname -m) SOURCES += $(SOURCES_linux) EXTENSION = pd_linux SHARED_EXTENSION = so @@ -448,3 +472,6 @@ showsetup: @echo "NDK_TOOLCHAIN: $(NDK_TOOLCHAIN)" @echo "NDK_BASE: $(NDK_BASE)" @echo "NDK_SYSROOT: $(NDK_SYSROOT)" + @echo "RASPI_BASE: $(RASPI_BASE)" + @echo "RASPI_PREFIX: $(RASPI_PREFIX)" + @echo "RASPI_STRIP: $(RASPI_STRIP)"
-
audiomobster
For me I hardcoded the RASPI uname like this.
UNAME := $(shell uname -s)
+UNAME=RASPICould someone tell me a way to override this in my build environment with a variable. I'm using Eclipse. I have already set a "Build Variable" and an "Environment Variable" but those are simply ignored.