Saturday, August 20, 2022

Plua 2 continued: open source under GPL for your classic Palm

More good news for classic PalmOS development. In previous articles, I've introduced you to Plua, a PalmOS 3.5 native version of Lua 5.0.3. By generous permission of Marcio Migueletto de Andrade, its original developer, we already have a 64-bit fixed open source version of the "cross-compiler" plua2c, which we use to build Overbite Palm.

Well, Marcio has uploaded the source code for Plua 2.0 itself, which I have patched up to build on my Power Mac G5. This is really great to see because now the runtime can be updated with more features and for more devices, particularly the wide-screen AlphaSmart dana.

I can't advise you currently on how to build on other platforms, but I will point out that prc-tools is quite old and you really need a 32-bit host (or at least one that can run 32-bit binaries) to make this work. My G5 under Mac OS X Tiger fills this bill: even though it's a 64-bit CPU, it runs 32-bit software without comment. I also tested these build instructions on my iMac G4 that doesn't even have Xcode, and it builds out of the box there too. So here's how to do it on your Power Mac and those of you on x86 (or a compatible x86_64 operating system) can install the analogous packages for your platform. It may also work under Rosetta for Intel users on 10.4-10.6 (sorry, Apple silicon, you'll probably need to do this in QEMU or UTM).

All Power Mac binaries referenced below are on the Floodgap gopher server. Firefox 3.6, Camino and Classilla all have built-in support for Gopher, as does OmniWeb, or you can add OverbiteFF to TenFourFox.

  • Install PRC Tools for Mac OS X. Although it says you should install Xcode first, you don't have to (you only need it if you intend to use Xcode for development, which we don't). You can read the documentation on the Wayback Machine, but the binaries are long gone, so we host revision 3 on the Gopher server. Grab PRC-Tools-r3.dmg.gz, decompress it, open the .dmg and run the installer package. This will install the basic compilers and some support utilities to /usr/local and the SDKs for PalmOS 4 and PalmOS 5 to /opt/palmdev. This is a straight build of PRC Tools 2.3 with m68k-palmos-gcc 2.95.3 and arm-palmos-gcc 3.3.1 (though we're building strictly 68K here).

  • Next, install the PRC Tools update I provide (PRC-Tools-r3-Update.tar.gz). This is a tarball, not a disk image. Download it (we'll assume it's in ~/Downloads), cd / and do sudo tar xzvf $HOME/Downloads/PRC-Tools-r3-Update.tar.gz to do the upgrade. This upgrades PilRC to 3.2.64 and installs multilink with all needed artifacts built for Tiger PPC. (This may work with Jag or Panther, but I don't warrant that nor support them. The source code for PilRC "3.2.64" and multilink with my local tweaks is here for GPL compliance, but you don't need it if you don't intend to hack on it.)

    x86 users may be able to use prc-tools-remix, but I haven't tested this, so I don't know if it's sufficient to build the app. You may need to provide your own m68k-palmos-multilink and you may need to update your PilRC manually. You could try this PilRC fork or build my own 3.2.64 from source.

  • Next, install the PalmOne SDK. This is not included with PRC Tools. You can get all of the SDKs from here, but since the Mac PRC Tools package already provides the SDKs for PalmOS 4 and PalmOS 5, I have a pared-down PalmOne-only SDK (palmone-sdk.tar.gz) and Plua will build with just that. Download it (we'll assume it's in ~/Downloads), cd / and sudo tar xzvf $HOME/Downloads/palmone-sdk.tar.gz to install it to /opt/palmdev.

  • Optionally, install pilot-xfer for transferring your binaries to a real device. If you have Palm Desktop on your Power Mac already then you don't need this, but it's handy to use from the command line. Download it (we'll assume it's in ~/Downloads), cd / and sudo tar xzvf $HOME/Downloads/pilot-xfer-darwin8-ppc.tar.gz to install it to /usr/local.

  • If you did all this right, it's time to download the source code from my Github fork (and/or transfer it from your current machine to the Power Mac). If you only have a Power Mac and you don't already have a compatible git from something like Tigerbrew, you can use Crypto Ancienne to grab a snapshot. Get the Rhapsody build, untar it, pull out the carl binary and put it somewhere in your path, then enter

    carl -t `carl -H https://github.com/classilla/plua2/archive/refs/heads/master.zip | awk -F ': ' 'BEGIN{RS="\r\n";ORS=""}/Location:/{print $2}'` > out.zip

    and unzip out.zip. Regardless of how you get it, enter the source directory and just type make. The app will build and deposit the .prc executables into bin/palmos.

So what are my own plans for Plua? I'd first like to create a custom runtime for the AlphaSmart dana that supports the wide screen and exposes it to scripts and compiled applications, and to allow scripts to specify the minimum (or exact) version of the runtime they want for upward compatibility. I'd also like to create a scrollbar control to be used as part of composite controls (currently you can only get this as part of the text widget; Plua doesn't provide it itself), and to allow Plua scripts to call other applications through something like SysUIAppSwitch() so that the hard buttons can be made to act like they would in "real" apps. I'm also thinking about ways to eliminate or reduce the MathLib dependency and even embed the scripts into copies of the runtime so that they're self-contained, though this would likely have to be hacked into plua2c specifically. And I'm sure there are other devices that need better support; we already know the Cliés' built-in WiFi seems to have some issues with Plua's networking code.

But it all starts with getting Plua building first. If you have some ideas, or get it building on your system, post in the comments. Plua is a great way to dive into classic Palm programming and now we have the opportunity to make it even better. Again, Marcio, many thanks!

No comments:

Post a Comment

Comments are subject to moderation. Be nice.