Shop Learn
Packaging tools for Propeller2 — Parallax Forums

Packaging tools for Propeller2

pullmollpullmoll Posts: 811
edited 2021-02-21 11:42 in Propeller 2

Hi there,
some of you may remember me from the old P1 forums, Z80 and emulators stuff etc.
I now finally got my P2 mini starter bundle and want to use it on Linux.

For a couple of years I have been packaging libraries and applications for Void Linux: and, and this is the distribution I use for my daily work and everything else.

What I wanted to do now is create set of package templates for the P2 tools which can be built for Linux.
I don't yet have a detailed insight to what's needed and what makes sense to package.

Can someone point me to a list of packages and ideally their dependencies?
I saw that and probably have most of what I need or want. Still, some advice to what comes first and/or what depends on what else would make the job of creating a bundle of P2 packages for Void a lot easier for me.

Cheers and many thanks for the years of development of the P2


  • evanhevanh Posts: 10,429

    Parallax tools are Windoze only at the moment. So, for them, Wine could be considered a dependency.

    David Zemon might be helpful -

    Peter Jakacki has Taqoz listed just down from there.

    For Eric's tools, I've only used flexspin and loadp2. Both are simple compiles with GCC via a makefile once cloned from Github. Flexprop is in TCL, I haven't used it.

    Ross H has Catalina -

  • ersmithersmith Posts: 4,750
    edited 2021-02-21 12:12

    If it's just the P2 you're interested in then I think has everything you need to get started. It depends on the usual build tools, bison, and Tk8.6 or later -- actually Tk8.5 probably works as well, that's what's used on the Mac. The control file for building .deb packages is checked in to DEBIAN/control, although most people have been building from source. The steps for that are:

    mkdir src # if it doesn't already exist
    cd src
    git clone --recursive
    cd flexprop
    make install INSTALL=/opt/flexprop
    # now everything is available in /opt/flexprop

    To add P1 support also requires OpenSpin from Openspin is only used while building (the WiFi support in proploader requires it), it isn't needed at run time.

  • pullmollpullmoll Posts: 811
    edited 2021-02-21 12:24

    Packaging with wine as a dependency is not an option for Void.
    If you want to, or have to, use Windows, you can use either of wine, qemu, virtualbox-ose with a Windows installation or similar, and people generally know and accept that. I want to package what runs on Linux w/o emulation.

    I'll have a look a David Zemon's package list and take that as a guide. Tcl is an easy dependency.

    I started my try with loadp2 from totalspectrum only to realize it needs a fastspin binary on the host:

    fastspin -2 -o board/P2ES_flashloader.bin board/P2ES_flashloader.spin2

    so I first have to package the app which contains fastspin and list it as a host dependency.
    We (read: Void Linux) also cross build packages for e.g. aarch64, arm, mips, and for two C libraries: glibc and musl.
    Once I figured the hierarchy of dependencies it should be easy to add the package templates.

    Thanks for the links!

  • pullmollpullmoll Posts: 811
    edited 2021-02-21 12:56

    Ok, trying to package spin2cpp I need bison/flex in the host. Then I see a missing include file "ast.h" which probably comes from yet another dependency. Looks like I need to set some CFLAGS or CPPFLAGS for include paths.

    I'll see how far I get with flexprop.

    FWIW Void Linux does not use git clone but distfiles (tarballs) for reproducible builds.
    Thus for flexprop I need to convert the recursive dependencies either as additional distfiles in the same template, listing their version numbers or git hashes, or make them separate packages to be built and to be included as make dependencies.

  • ersmithersmith Posts: 4,750

    flexprop has everything you need -- it includes spin2cpp and loadp2, and builds them in the appropriate order. Do the recursive clone, and then ignore the .git subdirectory and just use the spin2cpp and loadp2 subdirectories that git checked out. I think it's easier than trying to build them yourself individually.

    If you do want to build the projects seperately, the build order is:
    spin2cpp, then loadp2, then flexprop
    that is, flexprop depends on both loadp2 and spin2cpp, and loadp2 depends on spin2cpp.

    I don't understand why ast.h woud be missing in your spin2cpp build. That's not an external dependency, it's at the top level of the spin2cpp tree. I think something must have gone wrong with your checkout.

  • pullmollpullmoll Posts: 811
    edited 2021-02-21 13:58

    The spin2cpp template is now working. Step #1 done, and I managed to use a wrong commit title ;-)

    @ersmith the problem was that Void package build system defines the CFLAGS and so the ones in the Makefile would not be used. OTOH if I had used the Makefile CFLAGS (by setting make_use_env=yes), the Void hardening would not be used. The solution was to append the Makefile's CFLAGS to the ones which the packaging system defines. This is what the template now does.

    The -fcommon is required because gcc10 complains about multiple definitions for a symbol, in this case it was gl_progname. GCC versions prior to 10.x silently combined these definitions to a common address.

  • ersmithersmith Posts: 4,750

    For loadp2 you may want to grab a new copy; I forgot to change "fastspin" to "flexspin" in board/sdcard/Makefile, so it probably wasn't working (in the flexprop build environment this doesn't matter, the flexprop Makefile overrides the loadp2 one). Just checked in the fix.

  • pullmollpullmoll Posts: 811
    edited 2021-02-21 13:48

    @ersmith Yeah, loadp2 is next and in the template I used the 037 release so far. Would you mind to tag another release with the fix(es)?

  • pullmollpullmoll Posts: 811
    edited 2021-02-21 14:37

    It seems I need to add the ./include in spin2cpp and put them into e.g. usr/include/spin2cpp.
    We usually divide package binaries and libraries from development files, so there should be a spin2cpp-devel package which has these include files, while the binaries would go in the main package.

    Or are the binaries useless without these includes in any case?
    Then the spin2cpp package itself should have the include files.

    For loadp2 I then need to specify the location of these include files with -I as far as I can tell.
    I tried with the latest git commit 4171a18abac40131da4ddb745a2b20ec215a2d6d.
    The Makefile doesn't use CFLAGS or CPPFLAGS at all, so I'll have to patch it...

    ..or rather write a new Makefile ;-) Compiling multiple *.c files into one binary in one step is causing all kinds of troubles.

  • ersmithersmith Posts: 4,750
    edited 2021-02-21 15:36

    The spin2cpp include directory is needed in order to compile binaries for the P2 (the plain spin2cpp converter from Spin to C can probably get by without it, but I haven't checked lately).

    The usual directory tree for this stuff is something like:

    ROOT=/opt/flexprop  # or wherever you would like it
    $ROOT/bin/          # binaries: spin2cpp, flexspin, flexcc, loadp2
    $ROOT/board/        # board support files from loadp2
    $ROOT/doc/          # documentation from flexprop
    $ROOT/flexprop.tcl  # main flexprop script
    $ROOT/include/      # include files from spin2cpp

    Putting them in this kind of format makes things simpler, since e.g. flexspin looks for its include files by default in ../include relative to its own binary. There are environment variables that you can use to override these. Note that the spin2cpp include files are for building binaries for use on the P2, not for the host, so I wouldn't put them under /usr/include.

    I suggest creating some standard P2 tool root (like /usr/local/p2tools) and using the layout above for where things go relative to this. Then either create symlinks in /usr/local/bin, or have simple script files that invoke the tools from their "canonical" place.

    (My native build environment is Debian Linux, and I actually keep all the tools in a folder called "flexprop" in my home directory, and added ~/flexprop/bin to my PATH.)

  • ersmithersmith Posts: 4,750

    I created a new loadp2 release, and new releases for spin2cpp and flexprop. Current versions are v045 for loadp2, and v5.1.1 for flexprop and spin2cpp.

  • Uh, ok, that makes sense! I'll probably use /usr/libexec/p2tools as a base directory then.
    We usually don't use /opt and definitely not /usr/local for packages managed by Void's xbps package manager.

    So when /usr/libexec/p2tools would be the base the binaries would install to /usr/libexec/p2tools/bin
    and can be symlinked into /usr/bin to make them available without changes to the user's PATH environment.

    Or there could be shell scripts like /usr/bin/flexspin which first change to /usr/libexec/p2tools/binand then exec the real binary.

    'll try to get loadp2 working with using this layout and modified spin2cpp installation. Thanks for the hints!

  • pullmollpullmoll Posts: 811
    edited 2021-02-21 18:53

    Perfect. Now spin2cpp-5.1.1 installs as suggested to usr/libexec/p2tools and loadp2-045 builds w/o problems with this setup.
    So step #2 is done and next on the list is flexprop.

    Edit: Oh, there's PropLoader in the flexprop tree. Will see if I need to package that one also.

  • ersmithersmith Posts: 4,750

    PropLoader is P1 only, so if you're just interested in P2 support you can skip it (the Makefile will not try to build PropLoader if openspin is not installed).

  • pullmollpullmoll Posts: 811
    edited 2021-02-21 19:30

    I see. I missed to install version.h in the spin2cpp package.
    Looks like flexprop expects it to be in spin2cpp/version.hor is it include/spin2cpp/version.h? I will see.

  • ersmithersmith Posts: 4,750

    TBH there's nothing really to build for flexprop, if you already have loadp2 and flexspin then you just need the flexprop.tcl file and the src/ directory -- flexprop proper is written in Tcl so it doesn't need compilation. The bulk of the work in the flexprop Makefile is building the subsidiary tools in the right order, and converting the docs from markup to PDF and HTML (Oh yeah, making the .pdf files depends on TeX and pandoc, so if you want to build the docs you'll need those.) There's also a lot of Windows and Mac specific stuff which you won't need.

  • Cluso99Cluso99 Posts: 17,474

    Hi Jurgen,
    Welcome back!
    I used your QZ80 as a base (rather than heaters zicog) to get my cpm emulation running on P2 :)
    I haven't gone the whole hog and get xbyte running with it yet as I' still on the P2 OS.

    Interested to see where you go with the linux stuff and P2 ;)
    Rgds, Ray

  • pullmollpullmoll Posts: 811
    edited 2021-02-21 20:39

    Got flexprop to install w/o using the Makefile at all, i.e. just converted the spin2cpp/version.h to src/version.tcl and installed the scripts to /usr/libexec/p2tools/flexprop.tcl and /usr/libexec/p2tools/src.
    I removed the src/tcl_library because I want to use the tcl/tk provided by the system.
    The package template then creates a wrapper shell script in /usr/bin/flexprop which has export SOURCE=/usr/libexec/p2tools/src, changes the directory to /usr/libexec/p2tools and then calls exec /usr/bin/wish flexprop.tcl. So far that seems to work.

    I cannot however select my USB serial port which is /dev/ttyUSB0, and I think I need to patch in some additional devices to scan for.

    Uh, scrap that.. I should enable the USB device to make it appear in /dev :wink:

    Also need to depend on xterm because that is the default terminal and is not default installed in Void, because DEs usually have their own terminal implementations.

    Trying to compile one of the /usr/libexec/p2tools/samples files now of course fails because the user has no right to write into that directory. I'm thinking of making the wrapper script create a copy of the examples in e.g. ~/.local/share/p2tools/samples on the first run, i.e. when that directory does not yet exist.

  • The official builders of Void now packaged flexprop-5.1.1_1 and its dependencies and all is working fine.
    So thanks again @ersmith for the hints.

    Now the only thing I'd like to have is being able to define the flexprop main window font family and size.
    On a 4k display the UI is just too tiny to be useful :smiley:

    Hi @Cluso99 , glad to be here again. Now I have another great toy to waste time for. Life is wonderful.

  • ersmithersmith Posts: 4,750

    Great news, @pullmoll . Thanks for doing this!

    I'm not a Tcl/Tk expert, but I suspect there's some way to change the default font used for the UI elements like menus and such (maybe an environment variable? or an X11 setting?). The text and command window fonts are already customizable from the Options > Editor Options dialog box.

  • FWIW I tried to add this to src/gui.tcl which has some effect:

    font create myDefaultFont -family Sans -size 16
    option add *font myDefaultFont

    This option affects only the menu items and I have no idea how to specify the fonts for e.g. buttons, text input fields, labels etc. They are just as tiny as before.
    I will search the net for more detailed info on that option setting. Perhaps font family and size choice can then become a configurable and/or command line parameter.

Sign In or Register to comment.