RPA Toolkit
added build support for linux-i386
authorMartin Stoilov <martin@rpasearch.com>
Tue, 28 Jun 2011 04:18:51 +0000 (21:18 -0700)
committerMartin Stoilov <martin@rpasearch.com>
Tue, 28 Jun 2011 04:18:51 +0000 (21:18 -0700)
17 files changed:
arch/linux/i386/rtypes.h [new file with mode: 0644]
build/linux/build.mk
build/linux/i386/Makefile [new file with mode: 0644]
phpext/prpa/config.m4
rgrep/build/linux/i386/Makefile [new file with mode: 0644]
rgrep/build/linux/rgrep.mk
rgrep/build/linux/x86_64/Makefile
rjs/build/linux/i386/Makefile [new file with mode: 0644]
rlib/build/linux/i386/Makefile [new file with mode: 0644]
rpa/build/linux/i386/Makefile [new file with mode: 0644]
rvm/build/linux/i386/Makefile [new file with mode: 0644]
tests/testmisc/build/linux/i386/Makefile [new file with mode: 0644]
tests/testmisc/build/linux/x86_64/Makefile
tests/testrjs/build/linux/i386/Makefile [new file with mode: 0644]
tests/testrjs/build/linux/x86_64/Makefile
tests/testrpa/build/linux/i386/Makefile [new file with mode: 0644]
tests/testrpa/build/linux/x86_64/Makefile

diff --git a/arch/linux/i386/rtypes.h b/arch/linux/i386/rtypes.h
new file mode 100644 (file)
index 0000000..c869477
--- /dev/null
@@ -0,0 +1,99 @@
+#ifndef _RTYPES_H_
+#define _RTYPES_H_
+
+/* 
+ * Architecture dependent types. These types have to be redifined 
+ * for every architecture
+ */
+typedef signed char rint8;
+typedef unsigned char ruint8;
+typedef signed short rint16;
+typedef unsigned short ruint16;
+typedef signed int rint32;
+typedef unsigned int ruint32;
+typedef signed long long rint64;
+typedef unsigned long long ruint64;
+typedef unsigned long rsize_t;
+typedef signed long rssize_t;
+typedef unsigned int ratomic_t;
+typedef unsigned long rword;
+typedef long rsword;
+
+
+/*
+ * Common types. These types should be the same for most of the architectures.
+ */
+typedef long rlong;
+typedef int rinteger;
+typedef short rshort;
+typedef char rchar;
+typedef unsigned long rulong;
+typedef unsigned int ruinteger;
+typedef unsigned short rushort;
+typedef unsigned char ruchar;
+typedef ruchar rbyte;
+typedef double rdouble;
+typedef float rfloat;
+typedef rinteger rboolean;
+typedef void *rpointer;
+typedef const void *rconstpointer;
+typedef struct {ruint32 p1; ruint32 p2;} rpair_t;
+
+/*
+ * Atomic operations (Architecture Dependent)
+ */
+#define R_ATOMIC_CMPXCHG(ptr, oldval, newval, resptr) \
+               do { __asm__ __volatile__ ("lock; cmpxchgl %2, %1" \
+                       : "=a" (*(resptr)), "=m" (*ptr) \
+                       : "r" (newval), "m" (*ptr), "0" (oldval)); } while (0)
+
+#define R_ATOMIC_XCHG(ptr, val) \
+               do { __asm__ __volatile__("lock; xchgl %0,%1" \
+                       :"=r" ((ruint32) val) \
+                       :"m" (*(volatile ruint32 *)ptr), "0" (val) \
+                       :"memory"); } while (0)
+
+#define R_ATOMIC_ADD(ptr, val) \
+               do { __asm__ __volatile__ ("addl %1,%0" \
+                       : "=m" (*ptr) \
+                       : "ir" (val), "m" (*ptr)); } while (0)
+
+#define R_ATOMIC_SUB(ptr, val) \
+               do { __asm__ __volatile__ ("subl %1,%0" \
+                       : "=m" (*ptr) \
+                       : "ir" (val), "m" (*ptr)); } while (0)
+
+
+#define R_DEBUG_BRAKE __asm__ ("int $3")
+#define R_ASSERT(__a__) do {if (!(__a__)) R_DEBUG_BRAKE; } while (0)
+#define R_SIZE_ALIGN(s, n) ((((s) + (n) - 1) / (n)) * (n))
+#define R_MIN(a, b) ((a) < (b) ? (a): (b))
+#define R_MAX(a, b) ((a) > (b) ? (a): (b))
+
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((rpointer)0)
+#endif
+#endif
+
+#ifndef TRUE
+#define TRUE ((rboolean)1)
+#endif
+
+#ifndef FALSE
+#define FALSE ((rboolean)0)
+#endif
+
+
+typedef enum {
+       RVALSET_NONE = 0,
+       RVALSET_OR,
+       RVALSET_XOR,
+       RVALSET_AND,
+} rvalset_t;
+
+
+#endif
+
index d84f707..7f5f3d7 100644 (file)
@@ -32,8 +32,10 @@ install:
        +make -C $(SRCDIR)/rlib/build/$(OS)/$(ARCHDIR) install
        +make -C $(SRCDIR)/rpa/build/$(OS)/$(ARCHDIR) install
        +make -C $(SRCDIR)/rvm/build/$(OS)/$(ARCHDIR) install
+       +make -C $(SRCDIR)/rgrep/build/$(OS)/$(ARCHDIR) install
 
 uninstall:
        +make -C $(SRCDIR)/rlib/build/$(OS)/$(ARCHDIR) uninstall
        +make -C $(SRCDIR)/rpa/build/$(OS)/$(ARCHDIR) uninstall
        +make -C $(SRCDIR)/rvm/build/$(OS)/$(ARCHDIR) uninstall
+       +make -C $(SRCDIR)/rgrep/build/$(OS)/$(ARCHDIR) uninstall
diff --git a/build/linux/i386/Makefile b/build/linux/i386/Makefile
new file mode 100644 (file)
index 0000000..42bd64e
--- /dev/null
@@ -0,0 +1,6 @@
+SRCDIR = ../../..
+ARCHDIR = $(shell basename $(shell pwd))
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+
+
+include ../build.mk
index 3065e7c..236d382 100644 (file)
@@ -48,6 +48,9 @@ if test "$PHP_PRPA" != "no"; then
 
   OS_DIR=linux
   MACH=`uname -m`
+  if [[ $MACH == "i486" ]]; then MACH=i386; echo "MACH set to: $MACH"; fi
+  if [[ $MACH == "i586" ]]; then MACH=i386; echo "MACH set to: $MACH"; fi
+  if [[ $MACH == "i686" ]]; then MACH=i386; echo "MACH set to: $MACH"; fi
   ARCH_DIR=$RPATK_DIR/arch/$OS_DIR/$MACH
   RLIB_DIR=$RPATK_DIR/rlib
   RVM_DIR=$RPATK_DIR/rvm
diff --git a/rgrep/build/linux/i386/Makefile b/rgrep/build/linux/i386/Makefile
new file mode 100644 (file)
index 0000000..978ea8d
--- /dev/null
@@ -0,0 +1,29 @@
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+SRCDIR = ../../../..
+
+
+CC = gcc
+AR = ar
+ifeq ($(BLDCFG), release)
+CFLAGS = -O3
+else
+ifeq ($(BLDCFG), profile)
+CFLAGS = -O0 -pg
+else
+CFLAGS = -g -O0 -Wall 
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(MACH) $(INCLUDE)
+
+CFLAGS := $(CFLAGS)
+LDFLAGS = $(MACH)
+
+
+include ../rgrep.mk
index 48566c3..6076d1f 100644 (file)
@@ -1,3 +1,4 @@
+RPAGREP_BIN_INSTALL = /usr/bin
 RLIB_SRCDIR = $(SRCDIR)/rlib
 RVM_SRCDIR = $(SRCDIR)/rvm
 RPA_SRCDIR = $(SRCDIR)/rpa
@@ -40,4 +41,10 @@ clean:
        @rm -f $(OBJECTS)
        @rm -f $(OUTDIR)/$(RPAGREP)
 
+install:
+       cp $(OUTDIR)/$(RPAGREP) $(RPAGREP_BIN_INSTALL)
+
+uninstall:
+       rm $(RPAGREP_BIN_INSTALL)/$(RPAGREP)
+
 
index 4ecfdc7..978ea8d 100644 (file)
@@ -1,4 +1,4 @@
-ARCHDIR = x86_64
+ARCHDIR = $(shell basename $(shell pwd))
 OUTDIR = out
 OS = $(shell uname | tr "[:upper:]" "[:lower:]")
 SRCDIR = ../../../..
diff --git a/rjs/build/linux/i386/Makefile b/rjs/build/linux/i386/Makefile
new file mode 100644 (file)
index 0000000..91ff4e9
--- /dev/null
@@ -0,0 +1,25 @@
+SRCDIR = ../../../..
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+INCLUDE = -I$(SRCDIR)/arch/$(OS)/$(ARCHDIR)
+
+CC = gcc
+AR = ar
+LD = ld
+
+ifeq ($(BLDCFG), release)
+CFLAGS := -fPIC -O3
+else
+CFLAGS := -fPIC -O0 -g -Wall 
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(MACH) $(INCLUDE)
+LDFLAGS := $(MACH)
+
+
+include ../rjs.mk
diff --git a/rlib/build/linux/i386/Makefile b/rlib/build/linux/i386/Makefile
new file mode 100644 (file)
index 0000000..a2c8f9f
--- /dev/null
@@ -0,0 +1,31 @@
+SRCDIR = ../../../..
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+INCLUDE = -I$(SRCDIR)/arch/$(OS)/$(ARCHDIR)
+
+CC = gcc
+AR = ar
+LD = ld
+
+ifeq ($(BLDCFG), release)
+CFLAGS := -fPIC -O3
+else 
+ifeq ($(BLDCFG), profile)
+CFLAGS := -fPIC -O0 -pg -Wall 
+CFLAGS += -DR_DEBUG_MEMALLOC
+else
+CFLAGS := -fPIC -O0 -g -Wall 
+CFLAGS += -DR_DEBUG_MEMALLOC
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(MACH) $(INCLUDE)
+LDFLAGS := $(MACH)
+
+
+include ../rlib.mk
diff --git a/rpa/build/linux/i386/Makefile b/rpa/build/linux/i386/Makefile
new file mode 100644 (file)
index 0000000..c72fee8
--- /dev/null
@@ -0,0 +1,25 @@
+SRCDIR = ../../../..
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+INCLUDE = -I$(SRCDIR)/arch/$(OS)/$(ARCHDIR)
+
+CC = gcc
+AR = ar
+LD = ld
+
+ifeq ($(BLDCFG), release)
+CFLAGS := -fPIC -O3
+else
+CFLAGS := -fPIC -O0 -g -Wall 
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(MACH) $(INCLUDE)
+LDFLAGS := $(MACH)
+
+
+include ../rpa.mk
diff --git a/rvm/build/linux/i386/Makefile b/rvm/build/linux/i386/Makefile
new file mode 100644 (file)
index 0000000..dc78299
--- /dev/null
@@ -0,0 +1,30 @@
+SRCDIR = ../../../..
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+INCLUDE = -I$(SRCDIR)/arch/$(OS)/$(ARCHDIR)
+
+CC = gcc
+AR = ar
+LD = ld
+
+ifeq ($(BLDCFG), release)
+CFLAGS := -fPIC -O3
+else
+ifeq ($(BLDCFG), profile)
+CFLAGS := -fPIC -O0 -pg -Wall 
+else
+CFLAGS := -fPIC -O0 -g -Wall 
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+
+CFLAGS += $(MACH) $(INCLUDE)
+LDFLAGS := $(MACH)
+
+
+include ../rvm.mk
diff --git a/tests/testmisc/build/linux/i386/Makefile b/tests/testmisc/build/linux/i386/Makefile
new file mode 100644 (file)
index 0000000..d1ea48f
--- /dev/null
@@ -0,0 +1,29 @@
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+SRCDIR = ../../../../..
+
+
+CC = gcc
+AR = ar
+ifeq ($(BLDCFG), release)
+CFLAGS = -O3
+else
+ifeq ($(BLDCFG), profile)
+CFLAGS = -O0 -pg
+else
+CFLAGS = -g -O0 -Wall 
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(MACH) $(INCLUDE)
+
+CFLAGS := $(CFLAGS)
+LDFLAGS = $(MACH)
+
+
+include ../misc-tests.mk
index bf68cf7..d1ea48f 100644 (file)
@@ -1,4 +1,4 @@
-ARCHDIR = x86_64
+ARCHDIR = $(shell basename $(shell pwd))
 OUTDIR = out
 OS = $(shell uname | tr "[:upper:]" "[:lower:]")
 SRCDIR = ../../../../..
diff --git a/tests/testrjs/build/linux/i386/Makefile b/tests/testrjs/build/linux/i386/Makefile
new file mode 100644 (file)
index 0000000..d629c1d
--- /dev/null
@@ -0,0 +1,29 @@
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+SRCDIR = ../../../../..
+
+
+CC = gcc
+AR = ar
+ifeq ($(BLDCFG), release)
+CFLAGS = -O3
+else
+ifeq ($(BLDCFG), profile)
+CFLAGS = -O0 -pg
+else
+CFLAGS = -g -O0 -Wall 
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(MACH) $(INCLUDE)
+
+CFLAGS := $(CFLAGS)
+LDFLAGS = $(MACH)
+
+
+include ../testrjs.mk
index 16406c6..d629c1d 100644 (file)
@@ -1,4 +1,4 @@
-ARCHDIR = x86_64
+ARCHDIR = $(shell basename $(shell pwd))
 OUTDIR = out
 OS = $(shell uname | tr "[:upper:]" "[:lower:]")
 SRCDIR = ../../../../..
diff --git a/tests/testrpa/build/linux/i386/Makefile b/tests/testrpa/build/linux/i386/Makefile
new file mode 100644 (file)
index 0000000..1598920
--- /dev/null
@@ -0,0 +1,29 @@
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+SRCDIR = ../../../../..
+
+
+CC = gcc
+AR = ar
+ifeq ($(BLDCFG), release)
+CFLAGS = -O3
+else
+ifeq ($(BLDCFG), profile)
+CFLAGS = -O0 -pg
+else
+CFLAGS = -g -O0 -Wall 
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(MACH) $(INCLUDE)
+
+CFLAGS := $(CFLAGS)
+LDFLAGS = $(MACH)
+
+
+include ../testrpa2.mk
index 9923aa3..1598920 100644 (file)
@@ -1,4 +1,4 @@
-ARCHDIR = x86_64
+ARCHDIR = $(shell basename $(shell pwd))
 OUTDIR = out
 OS = $(shell uname | tr "[:upper:]" "[:lower:]")
 SRCDIR = ../../../../..