We are also able to run the binary, but I am unclear about
how we would package this into a .xo activity. Any pointers?

Am attaching an copy of an email I sent earlier to someone with a question similar to yours. IMHO that email provides a concise how-to guide to fashioning a bare-bones .xo package.

[Obviously, your 'exec' line must be appropriate to your binary.]

[The example had a library which was explicitly linked-to from within that binary. If your binary does not need any special library, just leave out the library part from the attached instructions.]

[If your binary *does* need to be supplied with a specific library, move that library into (for example) the subdirectory itself, then add this line (without the >) before your 'exec' line
 >  export LD_LIBRARY_PATH=$SUGAR_BUNDLE_PATH/your-library-name
to indicate *where* that library can be accessed.]



To produce the .xo file, just 'pack' the subdirectory you created.

mikus

Here is one way to package your stuff so it can be launched from an icon 
in the XO's Home View:

   DISCLAIMER:  To set this up, I used my templates from 2009 (for
   "sugarizing" a Linux executable).  I have __NOT__ referenced (nor
   incorporated) any SugarLabs advances from any intervening years.


   1) Create a directory (either in /home/olpc/Activities, or linked-to
      from there).  Mine was called "Evil.activity".

      In 'Evil.activity', create subdirectories 'activity' and 'bin'


   2) Move your binary into 'Evil.activity/'  [I called it 'evil.eng'}

      Move your 'id1' directory into 'Evil activity/'

        Note:  'Evil.activity' now contains:
                 activity    {a directory}
                 evil.eng    {a binary}
                 bin         {a directory}
                 id1         {a directory}

      Move your 'icon.svg' into 'Evil.activity/activity/'


   3) Add file 'Evil.activity/activity/activity.info' with content:
  >     [Activity]
  >     name = Evil
  >     service_name = com.atphalix.evil
  >     exec = runevil
  >     icon = icon
  >     activity_version = 1
  >     host_version = 1

      [Note:  This is how it was in 2009.  I have not looked at whether
       "activity.info" lines have been added/removed since then.]

      [In the above, you get to choose "name" and "service name"]

      'runevil' is the name of the script in 'Evil.activity/bin/'


   4) Copy 'libsugarize.so' into 'Evil.activity/bin/'

      Add file 'Evil.activity/bin/runevil' with content:
  >     #!/bin/bash
  >     while [ -n "$2" ] ; do
  >       echo "OO:" $1 $2
  >       case "$1" in
  >           -b | --bundle-id)     export SUGAR_BUNDLE_ID="$2" ;;
  >           -a | --activity-id)   export SUGAR_ACTIVITY_ID="$2" ;;
  >           -o | --object-id)     export SUGAR_OBJECT_ID="$2" ;;
  >           -u | --uri)           export SUGAR_URI="$2" ;;
  >           *) echo unknown argument $1 $2 ;;
  >       esac
  >       shift;shift
  >     done
  >     export LD_PRELOAD="$SUGAR_BUNDLE_PATH/bin/libsugarize.so"
  >     export NET_WM_NAME="Evil"
  >     exec ./evil.eng -mem 64 -width 1200 -height 900 +map start
  >     exit

     Obviously, the names/locations specified in this script must
     correspond to what is in your "Evil.activity" directory.

     [And when you create the two files whose content is shown above,
      please leave off the ">  " (they're for clarity in the printout).]


For me, the above worked.  [With an old libsugarize.so, there might be a 
redundant launch screen (with error message) left over.  It's harmless, 
and can eventually be closed.]

_______________________________________________
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel

Reply via email to