[racket] Is it possible to create a package without including source code?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Oct 21 08:48:03 EDT 2013

At Sun, 20 Oct 2013 20:15:12 -0400, Norman Ramsey wrote:
>  > In HEAD, you can do "raco pkg create --binary"
> 
> I need to distribute to students using vanilla 5.3.6.
> Should I expect the binaries to be compatible?

No.

> Can I create a 5.3.6 binary package by hand somehow?

Yes.

Let's assume that your package is called "a", and you're in a directory
containing "a" as a copy of your package sources. Then,

 * Link "a":

     raco pkg install --link a

   This step will both install the package as a link and compile sources
   to bytecode.

 * For each directory in "a" containing sources (probably just one:
   "a/a"), create an "info.rkt" file

        #lang setup/infotab
        (define assume-virtual-sources #t)

   If you already had an "info.rkt", add th` assume-virtual-sources`
   definition.

 * Delete all sources in "a" other than "info.rkt" files.

 * Delete all ".dep" files in "compiled" directories.

 * Create the package:

      raco pkg create a

You can confirm that "a.zip" has no sources with 

  unzip -l a.zip



> The problem I am actually trying to solve is to provide students with
> some functionality without allowing them to see the source code.
> Is there another way I should be thinking about achieving this outcome?

It depends on how difficult you need to make decoding. For another
possible strategy, see

 collects/framework/private/bday.rkt

in your v5.3.6 installation, or

https://github.com/plt/racket/blob/master/pkgs/gui-pkgs/gui-lib/framework/private/bday.rkt

in the current sources.


Posted on the users mailing list.