README-nacl.txt
author Gabriel Jacobo <gabomdq@gmail.com>
Sun, 08 Jun 2014 18:18:13 -0300
changeset 8851 a7cfe554d337
parent 8833 ae720d61d14d
child 8852 bb99ec3b21d8
permissions -rw-r--r--
Fixes audio for Native Client, and other fixes...

- SDL_NaClMount, SDL_NaClUmount
- Default mounting of https at / in SDL's main function
- More documentation in README-nacl.txt
gabomdq@8833
     1
================================================================================
gabomdq@8833
     2
Simple DirectMedia Layer for Native Client
gabomdq@8833
     3
================================================================================
gabomdq@8833
     4
gabomdq@8833
     5
Requirements: 
gabomdq@8833
     6
    
gabomdq@8833
     7
    * Native Client SDK (https://developer.chrome.com/native-client), 
gabomdq@8833
     8
      (tested with Pepper version 33 or higher).
gabomdq@8833
     9
gabomdq@8833
    10
The SDL backend for Chrome's Native Client has been tested only with the PNaCl
gabomdq@8833
    11
toolchain, which generates binaries designed to run on ARM and x86_32/64 
gabomdq@8833
    12
platforms. This does not mean it won't work with the other toolchains!
gabomdq@8833
    13
gabomdq@8833
    14
================================================================================
gabomdq@8833
    15
Building SDL for NaCl
gabomdq@8833
    16
================================================================================
gabomdq@8833
    17
gabomdq@8833
    18
Set up the right environment variables (see naclbuild.sh), then configure SDL with:
gabomdq@8833
    19
gabomdq@8833
    20
    configure --host=pnacl --prefix some/install/destination
gabomdq@8833
    21
    
gabomdq@8833
    22
Then "make". 
gabomdq@8833
    23
gabomdq@8833
    24
As an example of how to create a deployable app a Makefile project is provided 
gabomdq@8833
    25
in test/nacl/Makefile, which includes some monkey patching of the common.mk file 
gabomdq@8833
    26
provided by NaCl, without which linking properly to SDL won't work (the search 
gabomdq@8833
    27
path can't be modified externally, so the linker won't find SDL's binaries unless 
gabomdq@8833
    28
you dump them into the SDK path, which is inconvenient).
gabomdq@8833
    29
Also provided in test/nacl is the required support file, such as index.html, 
gabomdq@8833
    30
manifest.json, etc.
gabomdq@8833
    31
gabomdq@8833
    32
gabomdq@8833
    33
================================================================================
gabomdq@8833
    34
Running tests
gabomdq@8833
    35
================================================================================
gabomdq@8833
    36
gabomdq@8833
    37
Due to the nature of NaCl programs, building and running SDL tests is not as
gabomdq@8833
    38
straightforward as one would hope. The script naclbuild.sh in build-scripts 
gabomdq@8833
    39
automates the process and should serve as a guide for users of SDL trying to build 
gabomdq@8833
    40
their own applications.
gabomdq@8833
    41
gabomdq@8833
    42
Basic usage:
gabomdq@8833
    43
    
gabomdq@8833
    44
    ./naclbuild.sh path/to/pepper/toolchain (i.e. ~/naclsdk/pepper_35)
gabomdq@8833
    45
    
gabomdq@8833
    46
This will build testgles2.c by default.
gabomdq@8833
    47
gabomdq@8833
    48
If you want to build a different test, for example testrendercopyex.c:
gabomdq@8833
    49
    
gabomdq@8833
    50
    SOURCES=~/sdl/SDL/test/testrendercopyex.c ./naclbuild.sh ~/naclsdk/pepper_35
gabomdq@8833
    51
    
gabomdq@8833
    52
Once the build finishes, you have to serve the contents with a web server (the
gabomdq@8833
    53
script will give you instructions on how to do that with Python).
gabomdq@8833
    54
gabomdq@8833
    55
================================================================================
gabomdq@8851
    56
RWOps and nacl_io
gabomdq@8851
    57
================================================================================
gabomdq@8851
    58
gabomdq@8851
    59
SDL_RWops work transparently with nacl_io. Two functions are provided to control
gabomdq@8851
    60
mount points:
gabomdq@8851
    61
    
gabomdq@8851
    62
    
gabomdq@8851
    63
    For convenience, SDL will by default
gabomdq@8851
    64
mount an httpfs tree at / before calling the app's main function. Such setting
gabomdq@8851
    65
can be overriden by calling SDL_NaCl
gabomdq@8851
    66
gabomdq@8851
    67
For more information on how nacl_io and mount points work, see:
gabomdq@8851
    68
    
gabomdq@8851
    69
    https://developer.chrome.com/native-client/devguide/coding/nacl_io
gabomdq@8851
    70
gabomdq@8851
    71
================================================================================
gabomdq@8833
    72
TODO - Known Issues
gabomdq@8833
    73
================================================================================
gabomdq@8833
    74
* Testing of all systems with a real application (something other than SDL's tests)
gabomdq@8833
    75