Skip to content

Add new port

lex edited this page Mar 19, 2017 · 1 revision
  1. Create directory with your port name in /source/myport/ (/source/myport/<YOUR_PORT_NAME>)
  2. In created directory create Makefile.mk with content:
# List of directories for search source files (*.c)
# for example:
# . -- /source/myport/<YOUR_PORT_NAME>/
# utils -- /source/myport/<YOUR_PORT_NAME>/utils/
myport_dirs := .

# Next, we leave everything unchanged
myport_objs := $(call MODEST_UTILS_OBJS,$(call MyPORT_SELECTED_PORT),$(myport_dirs))
myport_all: $(myport_objs)
myport_clean: 
	rm -f $(myport_objs)

Please, see example

  1. In created directory create Rules.mk with content:
# Condition for include this port to build library
ifeq ($(OS),BEST_OS_EVER)
	MODEST_CFLAGS += -fPIC
	LIB_NAME_SUFFIX := .dylib

    # Important! Required!
	# Sets -DMODEST_BUILD_OS for all sources file in build moment
	MODEST_BUILD_OS := $(OS)
    # By this variable we call this port for including in build
	MODEST_PORT_NAME := <YOUR_PORT_NAME>
endif

Change all <YOUR_PORT_NAME> to your port name, it must be match by created directory name in /source/myport/.

Please, see example

  1. Done

By default, build system try to find all Rules.mk files in /source/myport/*/Rules.mk and try to find correct rule for your OS.

For example, how to build the library with selected port manually:

make OS=BEST_OS_EVER

if not need include/test others ports before build, only your, you can run build with command:

make MODEST_BUILD_OS=BEST_OS_EVER MODEST_PORT_NAME=<YOUR_PORT_NAME>

New port required basic functions for work with memory, io, threads (if build with threads, default) Example with all required function you can find in POSIX port

Clone this wiki locally