src

The following open-source projects are integrated into this project

Integrations

QNX ports integrations

Refer to the qnx-ports repo at: https://github.com/qnx-ports.

The projects include:

  • bash
  • vim
  • cairo

Example integration: bash

This example reviews the Makefile in the src folder to see how bash was integrated.

  1. Add a make target to download the project called source/<project>-ready. Here is the make target that was added to download bash:

    source/bash-ready:
    	mkdir -p source
    	cd source && git clone https://github.com/qnx-ports/bash.git
    	cd source/bash && git checkout $(BASH_SHA)
    	touch $@
    Note:

    A specific SHA is checked out to enable a reproducible build.

  2. Add a make target to build the project called source/<project>-built-$(QNX_ARCH). Here is the make target that was added to build bash:

    source/bash-built-$(QNX_ARCH): source/bash-ready source/build-files-ready
    	QCONF_OVERRIDE=$(PWD)/qconf-override.mk \
    	CPULIST=$(QNX_ARCH) \
    	QNX_ARCH=$(QNX_ARCH) \
    	QNX_PROJECT_ROOT="$(PWD)/source/bash" make -C source/build-files/ports/bash install -j4
    	touch $@

    Note the following:

    • There is a dependency on source/bash-ready. This ensures the source for bash is available.

    • Since this is a QNX ports project, it needs the source/build-files target as a dependency. This target performs the steps to setup the local build folders needed to build QNX ports projects.

    • CPULIST and QNX_ARCH is used to build bash only for the current architecture being built.

  3. Add to the PKGS variable:

    PKGS = bash vim cairo simple-terminal screenwm SDL SDL_image SDL_ttf SDL_net pattern-race

QNX projects integrations

Refer to the projects repo at https://gitlab.com/qnx/projects.

The projects include:

  • rpi-gpio
  • rpi-mailbox
  • rpi-thermal
  • simple-terminal

Example integration: rpi-gpio

This example reviews the Makefile in the src folder to understand how rpi-gpio was integrated.

  1. Add a make target to download the project called source/<project>-ready. Here is the make target that was added to download rpi-gpio:

    source/rpi-gpio-ready:
    	mkdir -p source
    	cd source && git clone https://gitlab.com/qnx/projects/rpi-gpio
    	cd source/rpi-gpio && git checkout $(RPI_GPIO_SHA)
    	touch $@
    Note:

    A specific SHA is checked out to enable a reproducible build.

  2. Add a Make target to build the project called source/<project>-built-$(QNX_ARCH):

    source/rpi-gpio-built-$(QNX_ARCH): source/cairo-built-$(QNX_ARCH) source/rpi-gpio-ready
    	cd source/rpi-gpio && \
    	QCONF_OVERRIDE=$(PWD)/qconf-override.mk \
    	QNX_ARCH=$(QNX_ARCH) \
    	make hinstall
    	cd source/rpi-gpio && \
    	EXTRA_INCVPATH=$(STAGE_COMMON)/usr/local/include \
    	EXTRA_LIBVPATH=$(STAGE_TARGET)/usr/local/lib \
    	MY_STAGE=$(STAGE_ROOT) make
    	cd source/rpi-gpio && \
    	QCONF_OVERRIDE=$(PWD)/qconf-override.mk \
    	QNX_ARCH=$(QNX_ARCH) \
    	EXTRA_INCVPATH=$(STAGE_COMMON)/usr/local/include \
    	EXTRA_LIBVPATH=$(STAGE_TARGET)/usr/local/lib \
    	MY_STAGE=$(STAGE_ROOT) make install
    	touch $@

    Note the following:

    • Although this project is not from QNX ports, it does have a dependency to the cairo project on QNX ports.
    • After cloning the project repo, execute more build steps than the previous project integration example. The reason for this is that this project uses QNX make, instead of a third party build system to build the project. There is at least one extra build step to install headers in the stage, that are required by the rpi-thermal project that is also integrated.
  3. Add to the PKGS variable. Only build the rpi-gpio project when building for a Raspberry Pi target:

    ifneq ($(filter rpi4 rpi5,$(TARGET)),)
    PKGS += rpi-gpio rpi-mailbox rpi-thermal
    endif

Additional open-source projects

This project integrates the following additional open-source projects:

  • screenwm
  • SDL
  • SDL_image
  • SDL_ttf
  • SDL_net
  • pattern-race
  • thorvg

Example Integration: SDL_net

This example reviews the Makefile in the src folder to see how SDL_net was integrated.

  1. Add a make target to download the project called source/<project>-ready. Here is the make target that was added to download SDL_net:

    source/SDL_net-ready:
    	mkdir -p source
    	cd source && git clone https://github.com/libsdl-org/SDL_net.git -b $(SDL_NET_VERSION)
    	cd source/SDL_net && git apply $(PWD)/patches/SDL_net.patch
    	touch $@
    

    Note the following:

    • A specific version is cloned to enable a reproducible build.
    • This project required a small patch to build, specifically to adjust an entry for the library to add a dynamic link to libsocket. When figuring out patches like this, you can determine patches while testing the new target being added. If you are patching a cloned git repo, you can use git diff to create the patch, then git apply to apply the patch after cloning.
  2. Add a make target to build the project called source/<project>-built-$(QNX_ARCH). Here is the make target that was added to build SDL_net:

    source/SDL_net-built-$(QNX_ARCH): source/SDL_net-ready source/SDL-built-$(QNX_ARCH)
    	mkdir -p source/SDL_net/build-$(QNX_ARCH)
    	cd source/SDL_net/build-$(QNX_ARCH) && cmake .. \
    		-DCMAKE_TOOLCHAIN_FILE=$(PWD)/patches/$(QNX_ARCH)-qnx.cmake \
    	        -DCMAKE_BUILD_TYPE=Release \
    	        -DCMAKE_INSTALL_PREFIX=$(STAGE_TARGET) \
    	        -DSDL2_LIBRARY=$(STAGE_TARGET)/lib/libSDL2-2.0.so \
    	        -DSDL2_INCLUDE_DIR=$(STAGE_TARGET)/include/SDL2
    	cd source/SDL_net/build-$(QNX_ARCH) && make
    	cd source/SDL_net/build-$(QNX_ARCH) && make install
    	touch $@

    Note the following:

    • This project has a dependency on the SDL project.
    • This project executes different build steps than the project examples above. This is because it uses CMake to support the open source project, which supports multiple platforms.
  3. Add to the PKGS variable:

    PKGS = bash vim cairo simple-terminal screenwm SDL SDL_image SDL_ttf SDL_net pattern-race

Local projects

Example integration: qnx-lottie_thorvg

This example reviews the Makefile in the src folder to see how qnx-lottie_thorvg was integrated.

  1. Add a make target to copy the qnx-lottie_thorvg project folder from local/ to source/:

    source/qnx-lottie_thorvg-ready:
    	mkdir -p source
    	cp -r $(PWD)/local/qnx-lottie_thorvg source/
    	touch $@
  2. Add a make target to build the project called source/<project>-built-$(QNX_ARCH):

    source/qnx-lottie_thorvg-built-$(QNX_ARCH): source/qnx-lottie_thorvg-ready source/thorvg-built-$(QNX_ARCH) \
        source/rpi-mailbox-built-$(QNX_ARCH)
    	mkdir -p $(STAGE_TARGET)/usr/local/bin
        cd source/qnx-lottie_thorvg && \
            EXTRA_INCVPATH=$(STAGE_TARGET)/usr/local/include \
            EXTRA_LIBVPATH=$(STAGE_TARGET)/usr/local/lib \
    		MY_STAGE=$(STAGE_ROOT) make install
        touch $@
    Note:

    This project has a dependency on the thorvg project and the rpi-mailbox project, both of which were integrated first.

  3. Add to the PKGS variable. Only build the qnx-lottie_thorvg project when building for a Raspberry Pi target, since it relies on rpi-mailbox:

    ifneq ($(filter rpi4 rpi5,$(TARGET)),)
    PKGS += rpi-gpio rpi-mailbox rpi-thermal qnx-lottie_thorvg
    endif

Testing the integrations

showimage

Refer to the "icons" section for more details regarding this utility, which is included from the SDL_image project integration.

showfont

Refer to the "fonts" section for more details regarding this utility, which is included from the SDL_ttf project integration.

screenwm

screenwm is an alternative window manager that you can use in place of the default fullscreen window manager.

Refer to the "system" section for more details regarding how to modify the recipe to launch the alternate window manager instead of the demolauncher (that launches by default).

SDL and related libraries

The SDL2 libraries (SDL, SDL_image, SDL_ttf, and SDL_net) are integrated into the build. You can use these libraries to integrate other open-source games built with SDL.

pattern-race

Pattern Race is a simple pattern-matching game that uses three of the SDL libraries. After you successfully build and flash the image, you can run it as follows:

patrace

The starting screen looks like this:


Pattern Race start screen
Page updated: