cellularmitosis / leopard.sh

Package managers for PowerPC Macs running OS X Leopard (10.5) and Tiger (10.4), written in Bash 😱
https://leopard.sh
MIT License
24 stars 1 forks source link

A few questions #1

Open tomas opened 2 years ago

tomas commented 2 years ago

Hi, I just discovered this project by accident. I have to say WOW! This is just what I was looking for. I have a few old PowerPC Macs and I'm thinking on writing a few multimedia apps to bring new life into them. I have a few questions though:

1) Why are some packages not listed in packages.txt while being available at the tigersh/dist and tigersh/scripts directories? (Eg. luajit or panther_sdl2) I can run tiger.sh luajit-2.1.0-beta3 though, however it runs the whole "building package from source" logic even though it detects a pre-compiled binary package.

2) What's the process for suggesting or adding new packages to the repository? In particular I'd like to have the following available: libcurl, zlib, and some video and audio libraries, starting with the ffmpeg libs (libavcodec, libavformat, etc).

3) Where are libraries installed by leopard/tiger.sh linked to? If I try to build something after installing some library (eg. libiconv, libcurl, etc) will it just work? Or do I need to pass something like LDFLAGS=$(tiger.sh --lib-path) when building?

That's all. Kudos for your work!

[EDIT: Added a third question]

tomas commented 2 years ago

Update: I was wrong about the luajit package. Turns out I was printing a few strings for debugging the tiger.sh script, and that was preventing the installer from downloading the precompiled package correctly. So it worked!

Now I did try to build a prompt for Lua I wrote, using the now-available luajit-5.1.2.1.0.dylib, however it looks like the "installer name" for the library isn't correctly set:

$ otool -l /opt/luajit-2.1.0-beta3/lib/libluajit-5.1.dylib  | fgrep -B1 -A5 LC_ID_DYLIB
Load command 3
          cmd LC_ID_DYLIB
      cmdsize 48
         name //libluajit-5.1.2.dylib (offset 24)
   time stamp 1647673732 Sat Mar 19 00:08:52 2022
      current version 2.1.0
compatibility version 2.1.0

Which results in the program erroring out after being built:

 $ ./lp 
dyld: Library not loaded: //libluajit-5.1.2.dylib
  Referenced from: /Users/imacg4/luaprompt-master/./lp
  Reason: image not found
Trace/BPT trap

Symlinking /opt/luajit-2.1.0-beta3/lib/libluajit-5.1.dylib to /usr/lib didn't fix the problem by itself. I also had to fix the installer name for the dylib using install_name_tool:

install_name_tool -id /usr/lib/libluajit-5.1.dylib libluajit-5.1.dylib

Now I could recompile without having to set the -L/opt/luajit-2.1.0-beta3/lib LDFLAG. Simply:

make CC="gcc-4.9 $(tiger.sh -mcpu)" CFLAGS="-I/opt/luajit-2.1.0-beta3/include/luajit-2.1/" LDFLAGS="-lluajit-5.1"

It would be great if leopard/tiger.sh offered a way of easily doing this though. :)

cellularmitosis commented 2 years ago

Hey Tomas! So glad you found this project useful!

As you have discovered, there is a bit of cruft, I went through a bit of a "2.0 migration" where I made a bunch of changes to the main script which required all of the "recipe" scripts to be updated, and I'm not yet 100% finished with that.

(Unfortunately, work became very busy -- you can see the point at which the commits stopped. We are shooting for a release within a few weeks, after which the work pressure will abate somewhat).

Also, some "recipes" are a bit work-in-progress / broken, so might not be listed in packages.txt.

libcurl and zlib should be easy additions, the ffmpeg stuff can hopefully also be added, that's mainly just an issue of slogging through all of its dependencies. Currently, the main blockers for some projects is the lack of a clang / llvm recipe and lack of a cmake recipe. Macports has both of these working, so its just a matter of digging through their patches to figure out which bits are needed specifically for tiger / leopard.

In general, its just a matter of having the free time :)

cellularmitosis commented 2 years ago

In terms of workflow, I usually start a new recipe by copying e.g. leopardsh/scripts/templates/build-from-source.sh and editing as needed.

I usually use the "compare selected" diff view in vscode to edit both the leopard and tiger version at the same time, which makes it easy to very the expected differences:

Screen Shot 2022-06-26 at 3 07 09 PM

tomas commented 2 years ago

Thanks for the response! I did stumble upon a few other things these days, so I might send a few PRs if you're interested (ideally after you push your recent changes).

Now, the biggest problem I found was that LuaJIT's FFI interface doesn't work, specifically when performing calls that include malloc'ing (calling ffi.C.sleep works OK). However I did read a recent message from you mentioning that you're in the quest to get it fixed! That would really be awesome.

Anyway, thanks again for the reply and I'll stay tuned for the upcoming release.