Building Harbour for Android from OSX

Building Harbour for Android from OSX

Postby Antonio Linares » Fri Mar 08, 2019 12:00 am

go_android.sh
Code: Select all  Expand view
export HB_PLATFORM=android
export HB_COMPILER=clang
export HB_CCPREFIX=/Users/anto/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/
export HB_INSTALL_PREFIX=/Users/anto/harbour
export HB_HOST_BIN=/Users/anto/harbour/bin/darwin/clang

export QT_PATH=/Users/anto/Qt/5.12.1/android_armv7
export HB_WITH_QT=$QT_PATH/include
export HB_QTPATH=$QT_PATH/bin

export HB_USER_CFLAGS="-D__ANDROID_API__=16 -target armv7-none-linux-androideabi -gcc-toolchain /Users/anto/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/arm-linux-androideabi/bin/ar$"
export HB_USER_DFLAGS=
export HB_USER_LDFLAGS=

make clean
make

# /Users/anto/harbour/bin/hbmk2 qtcontribs.hbp


clang.mk
Code: Select all  Expand view
ifeq ($(HB_BUILD_MODE),cpp)
   ifneq ($(findstring clang$(subst x, ,x)version$(subst x, ,x)1,$(shell clang --version)),)
      HB_BUILD_MODE := c
   endif
endif

ifeq ($(HB_BUILD_MODE),cpp)
   HB_CMP := clang++
else
   HB_CMP := /bin/armv7a-linux-androideabi28-clang
endif

OBJ_EXT := .o
LIB_PREF := lib
LIB_EXT := .a

HB_DYN_COPT := -DHB_DYNLIB -fPIC

CC := $(HB_CCACHE) $(HB_CCPREFIX)$(HB_CMP)$(HB_CCSUFFIX)
ifneq ($(filter --analyze, $(HB_USER_CFLAGS)),)
   CC_IN :=
else
   CC_IN := -c
endif
CC_OUT := -o

CFLAGS += -I. -I$(HB_HOST_INC)

ifneq ($(HB_BUILD_WARN),no)
   CFLAGS += -W -Wall
else
   CFLAGS += -Wmissing-braces -Wreturn-type -Wformat
   ifneq ($(HB_BUILD_MODE),cpp)
      CFLAGS += -Wimplicit-int -Wimplicit-function-declaration
   endif
endif

ifneq ($(HB_BUILD_OPTIM),no)
   CFLAGS += -O3
endif

ifeq ($(HB_BUILD_DEBUG),yes)
   CFLAGS += -g
endif

LD := $(CC)
LD_OUT := -o

LIBPATHS := $(foreach dir,$(LIB_DIR) $(SYSLIBPATHS),-L$(dir))
LDLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),-l$(lib))

LDFLAGS += $(LIBPATHS)

AR := $(HB_CCPREFIX)/arm-linux-androideabi/bin/ar
AR_RULE = ( $(AR) $(ARFLAGS) $(HB_AFLAGS) $(HB_USER_AFLAGS) rcs $(LIB_DIR)/$@ $(^F) $(ARSTRIP) ) || ( $(RM) $(LIB_DIR)/$@ && $(FALSE) )

DY := $(CC)
DFLAGS += -shared $(LIBPATHS)
DY_OUT := -o$(subst x,x, )
DLIBS := $(foreach lib,$(HB_USER_LIBS) $(SYSLIBS),-l$(lib))

DY_RULE = $(DY) $(DFLAGS) -Wl,-soname,$(DYN_NAME_CPT) $(HB_USER_DFLAGS) $(DY_OUT)$(DYN_DIR)/$@ $^ $(DLIBS) $(DYSTRIP) && $(LN) $(@F) $(DYN_FILE_NVR) && $(LN) $(@F) $(DYN_FILE_CPT)

include $(TOP)$(ROOT)config/rules.mk
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Building Harbour for Android from OSX

Postby Antonio Linares » Fri Mar 08, 2019 10:47 am

Building qtcontribs for Android from OSX:

https://groups.google.com/forum/#!topic/qtcontribs/7pIc-AaHzEA

As QT Creator changes as Android Studio, etc. change too, the best way to find the right flags is to create a project with QT Creator and review the used flags in the generated Makefile

Also I have found that building Harbour on Android itself (using termux) is simpler (can't build qtcontribs there, thats the disadvantage)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Building Harbour for Android from OSX

Postby Antonio Linares » Fri Mar 08, 2019 11:23 pm

There were some errors in my previous post. This one is ok:

https://groups.google.com/d/msg/qtcontribs/7pIc-AaHzEA/EMoyHzJ5CAAJ

You may download the Harbour and qtcontribs libraries for Android already built from here:
https://github.com/FiveTechSoft/harbour_and_xharbour_builds/blob/master/harbour_and_qtcontribs_android_20190308.zip
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to WhatsNew / Novedades

Who is online

Users browsing this forum: No registered users and 3 guests