portlibs: Difference between revisions

From devkitPro
Jump to navigation Jump to search
No edit summary
No edit summary
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
devkitPro are currently supplying a selection of useful libraries for porting purposes. These can be found in the [https://sourceforge.net/projects/devkitpro/files/portlibs/ portlibs section of sourceforge]. Eventually we hope to have the installer/updater pull these automatically but for now they can be installed manually. The archives should be extracted into the $DEVKITPRO/portlibs/<cpu> directory as appropriate, i.e. libpng-1.2.40-arm.tar.bz2 should be extracted to $DEVKITPRO/portlibs/arm and libpng-1.2.40-ppc.tar.bz2 to $DEVKITPRO/portlibs/ppc.
devkitPro supply a selection of useful libraries for porting purposes which are all available via [https://devkitpro.org/wiki/devkitPro_pacman devkitPro pacman].


To use these libraries in your projects just add $(PORTLIBS) to the LIBDIRS line and the appropriate lib to the LIBS line in the template makefiles, the devkitPro build system takes care of the rest.
To use these libraries in your projects you can mostly just add $(PORTLIBS) to the LIBDIRS line and the appropriate lib to the LIBS line in the template makefiles, the devkitPro build system takes care of the rest. Some libraries come with .pc files for pkg-config, others come with config scripts which may be found in the appropriate bin folder (/opt/devkitpro/portlibs/<platform>/bin).


For libraries which aren't currently provided you can attempt to build them manually - most portable libraries which use autotools should work. You'll need to do this from a bash shell (provided by msys under windows) with a fairly standard configure && make && make install approach.
For libraries which use a config script (i.e. freetype or sdl) you can add the appropriate incantations to the CFLAGS & LIBS lines like this :-
    CFLAGS = <other cflags as appropriate> `freetype-config --cflags` `sdl-config --cflags`
    #---------------------------------------------------------------------------------
    # any extra libraries we wish to link with the project
    #---------------------------------------------------------------------------------
    LIBS := `freetype-config --libs` <other libs as appropriate>


For arm libraries you do this - please note, configure should usually not be run from the source directory directly, create a build directory outside the source tree and configure from there. Most libraries work this way but some will require configuring & building from inside the source tree using ./configure
Similarly if a library has a .pc file (found in /opt/devkitpro/<platform>/lib/pkgconfig) you can use the appropriate pkg-config script found in /opt/devkitpro/portlibs/<platform>/bin. For instance devkitARM uses arm-none-eabi-pkg-config, devkitPPC uses powerpc-eabi-pkg-config & devkitA64 uses aarch64-none-elf-pkg-config. The stock Makefiles will have PREFIX set as appropriate.


  PATH=$DEVKITARM/bin:$PATH
    CFLAGS = <other cflags as appropriate> `$(PREFIX_pkg-config <list of libraries> --cflags`
  <path/to/>configure --prefix=$DEVKITPRO/portlibs/arm --host=arm-eabi --disable-shared --enable-static
    #---------------------------------------------------------------------------------
  make && make install
    # any extra libraries we wish to link with the project
    #---------------------------------------------------------------------------------
    LIBS := `$(PREFIX)pkg-config <list of libraries> --libs` <other libs as appropriate>


For ppc libraries obviously you use devkitPPC and --host=powerpc-eabi
You can also list all the available libraries by calling the appropriate script directly like this
    /opt/devkitpro/portlibs/3ds/bin/arm-none-eabi-pkg-config --list-all


  PATH=$DEVKITPPC/bin:$PATH
Again replace the path to <host>i-pkg-config as appropriate for other platforms.
  <path/to/>configure --prefix=$DEVKITPRO/portlibs/ppc --host=powerpc-eabi --disable-shared --enable-static
  make && make install


 
'''Note:''' For this to work you'll need both your host pkg-config & the appropriate platform pkg-config installed. These will be installed as part of the appropriate dev group.
These are the configure lines used for the prebuilt portlibs provided on Sourceforge. Where <path/to/> is used then the library was configured and built in a directory outside the source tree.
    (dkp-)pacman -Ss pkg-config
 
    dkp-libs/3ds-pkg-config 0.28-2
==zlib==
        pkg-config wrapper (for Nintendo 3DS homebrew development)
While zlib provides a configure script, it isn't a standard autotools configure and needs to be used differently.
    dkp-libs/nds-pkg-config 0.28-2
 
        pkg-config wrapper (for Nintendo DS homebrew development)
  CHOST=arm-eabi ./configure --static --prefix=$DEVKITPRO/portlibs/arm
    dkp-libs/ppc-pkg-config 0.28-3
 
        pkg-config wrapper (for Nintendo Gamecube/Wii homebrew development)
For devkitPPC replace arm-eabi with powerpc-eabi and prefix with $DEVKITPRO/portlibs/ppc.
    dkp-libs/switch-pkg-config 0.28-2
 
        pkg-config wrapper (for Nintendo Switch homebrew development)
==sqlite==
    dkp-libs/wiiu-pkg-config 0.28-2 (wiiu-dev)
 
        pkg-config wrapper (for Nintendo WiiU homebrew development)
  CFLAGS=-DSQLITE_OS_OTHER=1 <path/to>/configure --disable-shared --disable-threadsafe --disable-dynamic-extensions --host=arm-eabi --prefix=$DEVKITPRO/portlibs/arm
 
==libpng==
 
  CPPFLAGS=-I$DEVKITPRO/portlibs/arm/include LDFLAGS=-L$DEVKITPRO/portlibs/arm/lib <path/to>/configure \
  --prefix=$DEVKITPRO/portlibs/arm --host=arm-eabi --disable-shared --enable-static
 
==freetype==
  CPPFLAGS=-I$DEVKITPRO/portlibs/ppc/include \
  LDFLAGS=-L$DEVKITPRO/portlibs/lib \
  <path/to/>freetype-2.4.2/configure --disable-shared --enable-static --host=arm-eabi --prefix=/opt/devkitpro/portlibs/arm
 
==libjpeg==
<path/to>/configure --disable-shared --enable-static --host=arm-eabi --build=<build machine> --prefix=/opt/devkitpro/portlibs/arm

Latest revision as of 13:16, 17 May 2020

devkitPro supply a selection of useful libraries for porting purposes which are all available via devkitPro pacman.

To use these libraries in your projects you can mostly just add $(PORTLIBS) to the LIBDIRS line and the appropriate lib to the LIBS line in the template makefiles, the devkitPro build system takes care of the rest. Some libraries come with .pc files for pkg-config, others come with config scripts which may be found in the appropriate bin folder (/opt/devkitpro/portlibs/<platform>/bin).

For libraries which use a config script (i.e. freetype or sdl) you can add the appropriate incantations to the CFLAGS & LIBS lines like this :-

   CFLAGS	= <other cflags as appropriate> `freetype-config --cflags` `sdl-config --cflags`
   #---------------------------------------------------------------------------------
   # any extra libraries we wish to link with the project
   #---------------------------------------------------------------------------------
   LIBS	:=	`freetype-config --libs` <other libs as appropriate>

Similarly if a library has a .pc file (found in /opt/devkitpro/<platform>/lib/pkgconfig) you can use the appropriate pkg-config script found in /opt/devkitpro/portlibs/<platform>/bin. For instance devkitARM uses arm-none-eabi-pkg-config, devkitPPC uses powerpc-eabi-pkg-config & devkitA64 uses aarch64-none-elf-pkg-config. The stock Makefiles will have PREFIX set as appropriate.

   CFLAGS	= <other cflags as appropriate> `$(PREFIX_pkg-config <list of libraries> --cflags` 
   #---------------------------------------------------------------------------------
   # any extra libraries we wish to link with the project
   #---------------------------------------------------------------------------------
   LIBS	:=	`$(PREFIX)pkg-config <list of libraries> --libs` <other libs as appropriate>

You can also list all the available libraries by calling the appropriate script directly like this

   /opt/devkitpro/portlibs/3ds/bin/arm-none-eabi-pkg-config --list-all

Again replace the path to <host>i-pkg-config as appropriate for other platforms.

Note: For this to work you'll need both your host pkg-config & the appropriate platform pkg-config installed. These will be installed as part of the appropriate dev group.

   (dkp-)pacman -Ss pkg-config
   dkp-libs/3ds-pkg-config 0.28-2
       pkg-config wrapper (for Nintendo 3DS homebrew development)
   dkp-libs/nds-pkg-config 0.28-2
       pkg-config wrapper (for Nintendo DS homebrew development)
   dkp-libs/ppc-pkg-config 0.28-3
       pkg-config wrapper (for Nintendo Gamecube/Wii homebrew development)
   dkp-libs/switch-pkg-config 0.28-2
       pkg-config wrapper (for Nintendo Switch homebrew development)
   dkp-libs/wiiu-pkg-config 0.28-2 (wiiu-dev)
       pkg-config wrapper (for Nintendo WiiU homebrew development)