Skip to content

Creating a Final Distributable

cjshawMIT edited this page Mar 29, 2018 · 1 revision

Final Distributable Instructions

To create a final distributable, you can create an easy-to-install version of unplatform (with modules and assessment data). Example instructions and steps on how to do so are below. If you have other requirements for a final distribution (i.e. to include additional tools, synchronization software, etc.), you may have a different process to follow.

Building a macOS Application

Tools

To create a macOS application (i.e. CLIx.app), we use the Platypus application to create the .app bundle, and dmgbuild to create a distributable installer.

Build Steps

  1. Run the build_script_all_ssl.sh script in scripts/build_scripts.
  2. Open Platypus.
  3. Set Script Type to Bash.
  4. Set Script Path to point to bundle/unplatform_osx_ssl.sh.
  5. Update the App Name to just say CLIx.
  6. Set the Custom Icon to the file from bundle/static/assets/clix.png.
  7. Set the Identifier to org.clixindia.CLIx.
  8. Set the Author to CLIx.
  9. Set the Version to match the unplatform version.
  10. Add to Bundled Files all of the directories and files in bundle/ except the unplatform_*.zip file -- you don't need to re-include the zipped bundle.
  11. Check that the fields look like this screenshot. Platypus configuration for building unplatform into a macOS application
  12. Click Create App.
  13. Select the target output directory from the pop-up.
  14. Wait. Sometimes Platypus will appear to hang / show a beach ball when it is copying over a large number of files. Be patient. When it is done, the screen will become interactive again.
  15. Verify that your output CLIx.app file runs. Double-clicking it should cause Terminal to run both unplatform and qbank, and in a browser you should be able to navigate to https://localhost:8888 (if Chrome does not automatically open it) and interact with the modules. NOTE: Because we have not signed the application with Apple Developer certificates, users will get a warning when they attempt to run this for the first time. They can option-click on the application, then click "Open anyways" to bypass the security check.
  16. Now we create a CLIx.dmg installer so you can distribute the application.
  17. In a virtual environment (preferred) or just in your global directory, type in pip install dmgbuild in a Terminal window.
  18. Depending on how many modules you are including, and the expected size of the final .dmg file, you may need to adjust the size value in clix_settings.py (line 46). Currently it is set to 3GB.
  19. Run dmgbuild -s clix_settings.py "CLIx" CLIx.dmg
  20. Wait. You should see your CLIx.dmg file appear soon. Now you can distribute this to others.

Bundling into a Windows .exe Installer

Tools

Because the bundled files can reach over 2GB in size, you have to build this installer on a 64bit Windows machine (you can create a 32bit installer still). You'll also need NSISBI, plus all of the dependencies listed in its INSTALL file. You will have to build NSISBI from source.

  1. Download and extract NSISBI.
  2. Install Python 2.7.14 (SCONS, the compiler used for NSISBI, does not support Python 3+).
  3. Install SCONS 3.
  4. Download and extract the precompiled zlib 1.2.7 dll.
  5. Install a Visual C++ compiler. I used the 2015 build tools, and it worked fine.
  6. In Command Prompt, set the ZLIB_W32 environment variable to where you extracted zlib from step 4. set ZLIB_32=C:\<path>\zlib127.
  7. Download and install wxWidgets.
  8. Run an elevated Command Prompt (right-click and select Run as administrator).
  9. In the elevated Command Prompt, navigate to the NSISBI folder that you extracted in step 1. Build with scons PREFIX="C:\Program Files\NSIS" install.
  10. Once the installation has finished, you can use Explorer to navigate to C:\Program Files\NSIS. You should see makensisw.exe -- that's what we'll use to build the CLIx Installer.
  11. Now, you need to install the inetc plugin for NSIS. Download and unzip Inetc.zip.
  12. Copy Inetc\Plugins\x86-unicode\INetC.dll to C:\Program Files\NSIS\Plugins\x86-unicode.
  13. Copy Inetc\Plugins\x86-ansi\INetC.dll to C:\Program Files\NSIS\Plugins\x86-ansi.

Build Steps

  1. Run the build_script_all_ssl.sh script in scripts\build_scripts. OR, download a pre-bundled *.zip file from Google Drive and extract everything.
  2. Copy the modules you want installed to bundle\modules.
  3. Copy the corresponding unzipped webapps data bundle to bundle\webapps.
  4. Run the C:\Program Files\NSIS\makensisw.exe program.
  5. In NSIS, click File, and load the bundle\clix.nsi script. Watch it build.
  6. Now you have a CLIxInstaller.exe that you can distribute!

Bundling into a Debian .deb package (i.e. for Ubuntu)

Tools

The build scripts and steps provided here have been tested on Ubuntu 16.04, but theoretically should work on any other Debian platform.

You do not need any additional tools -- the build script provided will download and install the tools that it needs.

Build Steps

  1. Build the bundle or unzip a prepared bundle.
  2. Copy in the modules and webapps files into the bundle/ directory.
  3. Run the build_debian_package.sh script. You will get prompted for two things:
  • Your sudo password, to install some of the Debian build tools.
  • Verify that the Debian build information (e-mail, version, contact, etc.) are correct.
  1. Wait.
  2. After the build process is finished, you should see a Debian package in the clix/ directory (sibling to bundle/).

To install, you can use a package manager like GDebi. NOTE that there is a bug in Ubuntu, that may prevent from using the default Software Center to install third-party deb packages. Alternatively, you can install from the command-line, using sudo dpkg -i <filename>.deb.