Skip to content

Commit

Permalink
Update endianness detection on FreeBSD.
Browse files Browse the repository at this point in the history
This produces a working AOO on FreeBSD PowerPC64!

This is related to i126615 which was also fixed by Curtis a while ago.
Kudos for both contributions, makes me want to get a PowerPC to run
FreeBSD + AOO on it!

Author:	Curtis Hamilton -- cmhamilto at gmail


git-svn-id: https://svn.apache.org/repos/asf/openoffice/trunk@1773166 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
pfg committed Dec 8, 2016
1 parent 5d05905 commit e15a453
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 11 deletions.
Expand Up @@ -34,7 +34,7 @@ ENABLE_EXCEPTIONS=TRUE

# --- Files --------------------------------------------------------

.IF "$(COM)$(OS)$(CPU)$(COMNAME)$(CPUNAME)" == "GCCLINUXPgcc3POWERPC64"
.IF "$(COM)$(OS)$(CPU)$(COMNAME)$(CPUNAME)" == "GCCFREEBSDPgcc3POWERPC64"

.IF "$(cppu_no_leak)" == ""
CFLAGS += -DLEAK_STATIC_DATA
Expand Down
Expand Up @@ -24,7 +24,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_bridges.hxx"

#include <malloc.h>
#include <stdlib.h>

#include <com/sun/star/uno/genfunc.hxx>
#include <uno/data.h>
Expand Down
5 changes: 5 additions & 0 deletions main/desktop/source/deployment/misc/dp_platform.cxx
Expand Up @@ -57,6 +57,7 @@
#define PLATFORM_SOLARIS_SPARC64 "solaris_sparc64"
#define PLATFORM_SOLARIS_X86 "solaris_x86"
#define PLATFORM_FREEBSD_POWERPC "freebsd_powerpc"
#define PLATFORM_FREEBSD_POWERPC64 "freebsd_powerpc64"
#define PLATFORM_FREEBSD_X86 "freebsd_x86"
#define PLATFORM_FREEBSD_X86_64 "freebsd_x86_64"
#define PLATFORM_MACOSX_X86 "macosx_x86"
Expand Down Expand Up @@ -135,6 +136,10 @@ namespace
ret = checkOSandCPU(OUSTR("kFreeBSD"), OUSTR("X86_64"));
else if (token.equals(OUSTR(PLATFORM_LINUX_SPARC)))
ret = checkOSandCPU(OUSTR("Linux"), OUSTR("SPARC"));
else if (token.equals(OUSTR(PLATFORM_FREEBSD_POWERPC)))
ret = checkOSandCPU(OUSTR("FreeBSD"), OUSTR("PowerPC"));
else if (token.equals(OUSTR(PLATFORM_FREEBSD_POWERPC64)))
ret = checkOSandCPU(OUSTR("FreeBSD"), OUSTR("PowerPC64"));
else if (token.equals(OUSTR(PLATFORM_LINUX_POWERPC)))
ret = checkOSandCPU(OUSTR("Linux"), OUSTR("PowerPC"));
else if (token.equals(OUSTR(PLATFORM_LINUX_POWERPC64)))
Expand Down
3 changes: 3 additions & 0 deletions main/odk/settings/platform.mk
Expand Up @@ -34,6 +34,9 @@ else
ifeq "$(UNOPKG_PLATFORM)" "Linux_PowerPC"
EXTENSION_PLATFORM=linux_powerpc
else
ifeq "$(UNOPKG_PLATFORM)" "FreeBSD_PowerPC64"
EXTENSION_PLATFORM=freebsd_powerpc64
else
ifeq "$(UNOPKG_PLATFORM)" "Linux_x86"
EXTENSION_PLATFORM=linux_x86
else
Expand Down
7 changes: 7 additions & 0 deletions main/odk/settings/settings.mk
Expand Up @@ -507,6 +507,9 @@ UNOPKG_PLATFORM=FreeBSD_x86_64
else
UNOPKG_PLATFORM=FreeBSD_x86
endif
ifeq "$(PROCTYPE)" "powerpc"
UNOPKG_PLATFORM=FreeBSD_ppc
endif
endif

ifeq "$(PROCTYPE)" "x86_64"
Expand All @@ -515,6 +518,10 @@ else
JAVA_PROC_TYPE=i386
endif

ifeq "$(PROCTYPE)" "powerpc64"
JAVA_PROC_TYPE=ppc64
endif

ifeq (kfreebsd,$(findstring kfreebsd,$(PLATFORM)))
OS=LINUX
else
Expand Down
6 changes: 2 additions & 4 deletions main/sal/inc/osl/endian.h
Expand Up @@ -73,16 +73,14 @@ extern "C" {
#ifdef FREEBSD
# include <sys/param.h>
# include <machine/endian.h>
#if __FreeBSD_version < 500000
# if BYTE_ORDER == LITTLE_ENDIAN
# define _LITTLE_ENDIAN
# undef _BIG_ENDIAN
# elif BYTE_ORDER == BIG_ENDIAN
# define _BIG_ENDIAN
# undef _LITTLE_ENDIAN
# elif BYTE_ORDER == PDP_ENDIAN
# define _PDP_ENDIAN
# endif
#endif
#endif

#ifdef SCO
# include <sys/types.h>
Expand Down
8 changes: 4 additions & 4 deletions main/sal/osl/unx/system.h
Expand Up @@ -126,6 +126,8 @@

#endif

#include <osl/endian.h>

#ifdef NETBSD
# define ETIME ETIMEDOUT
# define _POSIX_THREAD_SYSCALL_SOFT 1
Expand Down Expand Up @@ -176,15 +178,13 @@
# include <netinet/tcp.h>
# define IORESOURCE_TRANSFER_BSD
# include <machine/endian.h>
#if __FreeBSD_version < 500000
# if BYTE_ORDER == LITTLE_ENDIAN
# define _LITTLE_ENDIAN
# undef _BIG_ENDIAN
# elif BYTE_ORDER == BIG_ENDIAN
# define _BIG_ENDIAN
# undef _LITTLE_ENDIAN
# elif BYTE_ORDER == PDP_ENDIAN
# define _PDP_ENDIAN
# endif
#endif
# define NO_PTHREAD_RTL
#endif

Expand Down
10 changes: 10 additions & 0 deletions main/solenv/gbuild/platform/freebsd.mk
Expand Up @@ -36,6 +36,10 @@ ifeq ($(CPU),X)
CPUNAME := X86_64
endif

ifeq ($(CPU),P)
CPUNAME := POWERPC64
endif

# use CC/CXX if they are nondefaults
ifneq ($(origin CC),default)
gb_CC := $(CC)
Expand Down Expand Up @@ -68,6 +72,12 @@ else
gb_CPUDEFS := -DX86
endif

ifeq ($(CPUNAME),POWERPC64)
gb_CPUDEFS := -D$(CPUNAME)
else
gb_CPUDEFS := -DPOWERPC64
endif

gb_CFLAGS := \
-Wall \
-Wendif-labels \
Expand Down
3 changes: 3 additions & 0 deletions main/solenv/inc/libs.mk
Expand Up @@ -237,6 +237,9 @@ NEON3RDLIB=$(SOLARLIBDIR)/libneon.dylib
.ELSE
NEON3RDLIB=-lneon
.ENDIF
.IF "$(OS)" == "FREEBSD" && "$(CPUNAME)" == "POWERPC64"
JPEG3RDLIB=/usr/local/lib/libjpeg.so
.ENDIF
CURLLIB=-lcurl
SFX2LIB=-lsfx$(DLLPOSTFIX)
SFXLIB=-lsfx$(DLLPOSTFIX)
Expand Down
4 changes: 4 additions & 0 deletions main/solenv/inc/unx.mk
Expand Up @@ -95,6 +95,10 @@
.INCLUDE : unxlngppc64.mk
.ENDIF

.IF "$(COM)$(OS)$(CPU)$(CPUNAME)" == "GCCFREEBSDPPOWERPC64"
.INCLUDE : unxfbsdp.mk
.ENDIF

.IF "$(COM)$(OS)$(CPU)$(CPUNAME)" == "GCCLINUX3S390"
.INCLUDE : unxlngs390.mk
.ENDIF
Expand Down
3 changes: 3 additions & 0 deletions main/solenv/inc/unxfbsd.mk
Expand Up @@ -37,6 +37,9 @@ JAVAFLAGSDEBUG=-g
.IF "$(CPUNAME)" == "X86_64"
.INCLUDE : unxfbsdx.mk
.ENDIF
.IF "$(CPUNAME)" == "POWERPC64"
.INCLUDE : unxfbsdp.mk
.ENDIF
.IF "$(CPUNAME)" == "POWERPC"
.INCLUDE : unxfbsdppc.mk
.ENDIF
Expand Down
2 changes: 1 addition & 1 deletion main/testtools/source/bridgetest/makefile.mk
Expand Up @@ -134,7 +134,7 @@ ALLTAR: \

runtest : $(DLLDEST)$/uno_types.rdb $(DLLDEST)$/uno_services.rdb makefile.mk \
$(SHL1TARGETN) $(SHL2TARGETN) $(SHL3TARGETN)
.IF "$(COM)$(OS)$(CPU)" == "GCCMACOSXP" || "$(OS)$(CPU)"=="SOLARISS"
.IF "$(COM)$(OS)$(CPU)" == "GCCMACOSXP" || "$(OS)$(CPU)"=="SOLARISS" || "$(COM)$(OS)$(CPU)"=="GCCFREEBSDP"
@echo "Mac OSX PPC GCC and Solaris fails this test! likely broken UNO bridge. Fix me."
.ELSE
cd $(DLLDEST) && $(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/uno \
Expand Down

0 comments on commit e15a453

Please sign in to comment.