jjuran / metamage_1

Metamage open source, general repository, iteration 1
306 stars 27 forks source link

What is "vx" and how do I get it into my $PATH? #9

Closed probonopd closed 5 years ago

probonopd commented 5 years ago

https://github.com/jjuran/metamage_1/blob/db8b54f82da83daca9df4559434bb46e56e19b87/v/bin/ams.vx#L1

I don't have this installed on my system. Where can I get it from?

Build log: https://api.travis-ci.com/v3/job/194586148/log.txt

jjuran commented 5 years ago

Thanks for the direct link to the log; it renders fine in Terminal.

vx is the V Executor, an interpreter for a programming language I'm developing. Source for V is in the metamage_1repository, and the binary is automatically built and copied to var/out/ when you follow the Advanced Mac Substitute HOWTO, or more specifically by running ./build.pl -i vx.

https://www.vcode.org/

Note that OSes disagree in how to parse #!foo bar baz — some, like OS X, will regard bar and baz as separate arguments, but others, like GNU/Linux, consider bar baz to be one argument. In that case, you'll need to have a program literally named vx -Z; the make target you ran created one in bin/, whose contents are simply vx -Z "$@". Feel free to suggest another approach.

probonopd commented 5 years ago

Looks like I am missing the straight-forward, simple step-by-step instructions on how to compile the X.org version of the Mac emulator from scratch on, say, Ubuntu trusty.

jjuran commented 5 years ago

Several points:

The first command executed by the ams-x11 target's recipe builds vx already — an additional command to do so is redundant.

The emulator itself is platform-independent, relying only on POSIX. A front end, which displays the screen and relays input events, is required for interactive use (and has no knowledge of Mac emulation, per se). A front end for X11 users is provided by the interact-x11 program, which is built by the ams-x11 target.

There is no ams-x11 program.

The HOWTO is geared toward users who don't necessarily have experience building projects from source and tries to make it as simple as possible, at the cost of taking some shortcuts. I admit it's not perfect, but I'm open to making improvements (e.g. a proper install target).

On the one hand, things are very simple — apt-install a few packages, clone, cd, and run make ams-x11. That should get you the Welcome screen. On the other hand, you're treading new ground — not merely compiling the emulator, but packaging it. I haven't tried to walk anyone through this before.

You'll need half a dozen plus native binaries, as well as the emulated ams-foo modules, app tool, and any 68K Mac applications — in addition to the ams launcher script, which must be modified to find everything else (since it currently expects to be run out of the repository). To be honest, I'm not entirely sure where they should all go and I'd welcome the guidance of someone more knowledgeable.

probonopd commented 5 years ago

@jjuran I would like to help you package this into a very user friendly format, where a Macintosh application together with everything that is needed to run it on a Linux system is packaged inside a single AppImage file. The result will be that a user could download a single file, make it executable, double-click it, and run a Macintosh application on Linux.

I happen to know the AppImage format intimately and think it is a perfect match, but I may need some help from you getting the emulator to build (sorry for asking stupid questions).

Here is my work-in-progress compile script: https://github.com/probonopd/metamage_1/blob/patch-1/.travis.yml

The first command executed by the ams-x11 target's recipe builds vx already — an additional command to do so is redundant.

Why did I get the error /usr/bin/env: vx -Z: No such file or directory then? Possibly the tool gets built but not put on the $PATH?

jjuran commented 5 years ago

I'm going to reply in multiple comments this time.

To answer your last question, env sees vx -Z as its first argument on Linux. You need an interpreter literally named vx -Z, which internally calls vx with the -Z switch and its arguments. This should have been created in bin/ in the repository.

If you prefer, you could rename it vx-Z or vxZ or such, and modify the .vx file accordingly.

probonopd commented 5 years ago

My ./bin only contains:

./bin/make-info-plist
./bin/clone-repo
./bin/rsplit
./bin/make-icns
./bin/build-app
./sound

I have no vx -Z in ./bin.

Full log: https://api.travis-ci.com/v3/job/195149551/log.txt

Something is going wrong?

jjuran commented 5 years ago

My apologies! That step was omitted by ams-x11 — an oversight on my part. I just pushed a fix. You can also run make ams-vx-Z manually to create it.

jjuran commented 5 years ago

I see value in both self-contained application packages and a general emulator package with applications kept separately. In any case, the ams.vx launcher script needs to know where to find things. Native programs and scripts can be assumed to be found in PATH, but emulated code needs its own solution.

xv68k works like a language interpreter, except its programs are 68K machine code. The main program it runs is app (which launches a Mac application). It also loads modules, which modify the run-time environment in various ways. These are all loaded directly by xv68k and can be located anywhere that ams.vx can find them.

Anything else is loaded by emulated code, which is not given direct access to the native file system. Instead, it makes requests of a file server to which it's connected over a socket. This is how an application accesses any data files it uses, system resources (e.g. fonts, cursors, and icons), and its own code. Disk images are mounted by emulated system code and therefore use the same mechanism.

These categories (tools, modules, and server-provided) correspond the the bin, lib, and mnt subdirectories of ams-68k-bin. How about AMS_BIN, AMS_LIB, and AMS_MNT as environment variables to set these locations?

probonopd commented 5 years ago

I see value in both self-contained application packages and a general emulator package with applications kept separately.

Yes, indeed we can do both.

In any case, the ams.vx launcher script needs to know where to find things.

Can we make it so that ams.vx uses relative paths? E.g.,

/some/random/location/usr/bin/ams.vx
/some/random/location/usr/lib/
/some/random/location/usr/share/
...

In other words, ams.vx would call other binaries from the same directory as itself, load libraries from ../lib/ relative to the directory in which it is located itself, and so on.

In the AppImage project (and elsewhere), we call /some/random/location/ the "AppDir" and assume it can change randomly from invocation to invocation.

probonopd commented 5 years ago

Now getting a bit further, but stuck at

LINK  interact-x11
COPY  interact-x11
PATH="$PWD/bin:$PWD/var/out:$PATH" EXHIBIT_INTERACT=interact-x11 ./scripts/ams
exhibit: waiting for interactive viewer: Interrupted system call
./scripts/ams:169
    ERROR: uncaught exception: (module [("exit" => 1), ("argv" => ["exhibit", "-t", "Advanced Mac Substitute", "--raster=/home/travis/var/run/raster/ams", "--events-fd=3", "graft", "freemountd", "-q", "--root", "/home/travis/build/probonopd/metamage_1/v/bin/../../../ams-68k-bin/mnt", "//", "xv68k", "-tSP", "--raster=/home/travis/var/run/raster/ams", "-m", "[", "/home/travis/build/probonopd/metamage_1/v/bin/../../../ams-68k-bin/lib/ams-core", "--events-fd=3", "]", "-m", "/home/travis/build/probonopd/metamage_1/v/bin/../../../ams-68k-bin/lib/ams-io", "-m", "/home/travis/build/probonopd/metamage_1/v/bin/../../../ams-68k-bin/lib/ams-fs", "-m", "/home/travis/build/probonopd/metamage_1/v/bin/../../../ams-68k-bin/lib/ams-rsrc", "-m", "/home/travis/build/probonopd/metamage_1/v/bin/../../../ams-68k-bin/lib/ams-pack", "-m", "/home/travis/build/probonopd/metamage_1/v/bin/../../../ams-68k-bin/lib/ams-seg", "-m", "/home/travis/build/probonopd/metamage_1/v/bin/../../../ams-68k-bin/lib/ams-qd", "-m", "/home/travis/build/probonopd/metamage_1/v/bin/../../../ams-68k-bin/lib/ams-ui", "/home/travis/build/probonopd/metamage_1/v/bin/../../../ams-68k-bin/bin/app", "Welcome"])])
make: *** [ams-x11] Error 1
The command "make ams-x11" exited with 2.

Full log: https://api.travis-ci.com/v3/job/195348652/log.txt

Can it be that it is trying to run the compiled X.org application? If yes, how can I disable that?

jjuran commented 5 years ago

Are you running make ams-x11 from a shell in which DISPLAY is unset?

probonopd commented 5 years ago

Yes. A headless build server.

jjuran commented 5 years ago

That would do it. You've reached the point where everything is built and it's trying to launch the emulator, and the front end dies unexpectedly.

probonopd commented 5 years ago

How can I prevent it from trying to launch the emulator after it has been built?

jjuran commented 5 years ago

I just pushed a change that adds an ams-x11-build target that does everything but launch the emulator.

probonopd commented 5 years ago

So, it looks like the build itself succeeds. Now is the question which build products do I need to bundle for distributing them to end users?

jjuran commented 5 years ago

The latest ams.vx now looks for 68K code in ../share/ams/{bin,lib,mnt}.

By the way, if you install the launch script as a user-runnable command in PATH, please rename it to ams.

jjuran commented 5 years ago

Native binaries and scripts: vx vx -Z raster exhibit interact-x11 graft freemountd xv68k sndtrack

ams/bin: app

ams/lib: ams-*

ams/mnt: AMS Resources any built-in applications

sndtrack is optional. Install portaudio19-dev and run make sndtrack to build it.

probonopd commented 5 years ago

Does this AppDir roughly look correct to you?

./appdir/
./appdir/usr
./appdir/usr/share
./appdir/usr/share/icons
./appdir/usr/share/icons/scalable
./appdir/usr/share/icons/scalable/apps
./appdir/usr/share/icons/scalable/apps/ams.svg
./appdir/usr/share/applications
./appdir/usr/share/applications/ams.desktop
./appdir/usr/bin
./appdir/usr/bin/raster
./appdir/usr/bin/vx
./appdir/usr/bin/vx -Z # Tends to break
./appdir/usr/bin/graft
./appdir/usr/bin/freemountd
./appdir/usr/bin/exhibit
./appdir/usr/bin/interact-x11
./appdir/usr/bin/xv68k
./appdir/usr/mnt
./appdir/usr/mnt/MacBinaryDecoder
./appdir/usr/mnt/MacBinaryDecoder/Rez
./appdir/usr/mnt/MacBinaryDecoder/Rez/mBin.vers.r
./appdir/usr/mnt/MacBinaryDecoder/Rez/mBin.icons.r
./appdir/usr/mnt/MacBinaryDecoder/Info.txt
./appdir/usr/mnt/MacBinaryDecoder/Build-origin.txt
./appdir/usr/mnt/MacBinaryDecoder/Resources
./appdir/usr/mnt/MacBinaryDecoder/Resources/MacBinaryIII.icns
./appdir/usr/mnt/MacBinaryDecoder/Resources/MacBinaryIII+.icns
./appdir/usr/mnt/MacBinaryDecoder/Resources/MacBinaryDecoder.icns
./appdir/usr/mnt/MacBinaryDecoder/MacBinaryDecoder.cc
./appdir/usr/mnt/MacBinaryDecoder/A-line.conf
./appdir/usr/mnt/MacBinaryDecoder/MacBinaryDecoder.hh
./appdir/usr/mnt/NyanochromeCat
./appdir/usr/mnt/NyanochromeCat/Rez
./appdir/usr/mnt/NyanochromeCat/Rez/app_name.h
./appdir/usr/mnt/NyanochromeCat/Rez/NYAN.vers.r
./appdir/usr/mnt/NyanochromeCat/Rez/NYAN.menu.r
./appdir/usr/mnt/NyanochromeCat/Rez/NYAN.icons.r
./appdir/usr/mnt/NyanochromeCat/Rez/Apple-menu.r
./appdir/usr/mnt/NyanochromeCat/NyanochromeCat.cc
./appdir/usr/mnt/NyanochromeCat/Info.txt
./appdir/usr/mnt/NyanochromeCat/Bitmap.hh
./appdir/usr/mnt/NyanochromeCat/Graphics.cc
./appdir/usr/mnt/NyanochromeCat/Resources
./appdir/usr/mnt/NyanochromeCat/Resources/NyanochromeCat.icns
./appdir/usr/mnt/NyanochromeCat/A-line.conf
./appdir/usr/mnt/Tic-tac-toe
./appdir/usr/mnt/Tic-tac-toe/state.cc
./appdir/usr/mnt/Tic-tac-toe/state.hh
./appdir/usr/mnt/Tic-tac-toe/Rez
./appdir/usr/mnt/Tic-tac-toe/Rez/XvO#.vers.r
./appdir/usr/mnt/Tic-tac-toe/Rez/app_name.h
./appdir/usr/mnt/Tic-tac-toe/Rez/XvO#.menu.r
./appdir/usr/mnt/Tic-tac-toe/Rez/Apple-menu.r
./appdir/usr/mnt/Tic-tac-toe/Rez/XvO#.icons.r
./appdir/usr/mnt/Tic-tac-toe/cursors.cc
./appdir/usr/mnt/Tic-tac-toe/cursors.hh
./appdir/usr/mnt/Tic-tac-toe/regions.cc
./appdir/usr/mnt/Tic-tac-toe/Info.txt
./appdir/usr/mnt/Tic-tac-toe/regions.hh
./appdir/usr/mnt/Tic-tac-toe/Tic-tac-toe.cc
./appdir/usr/mnt/Tic-tac-toe/Resources
./appdir/usr/mnt/Tic-tac-toe/Resources/Tic-tac-toe.icns
./appdir/usr/mnt/Tic-tac-toe/A-line.conf
./appdir/usr/mnt/Vertice
./appdir/usr/mnt/Vertice/Vertice
./appdir/usr/mnt/Vertice/Vertice/PortView.hh
./appdir/usr/mnt/Vertice/Vertice/Document.hh
./appdir/usr/mnt/Vertice/Vertice/PortView.cc
./appdir/usr/mnt/Vertice/Vertice/Main.cc
./appdir/usr/mnt/Vertice/Vertice/Document.cc
./appdir/usr/mnt/Vertice/Info.txt
./appdir/usr/mnt/Vertice/A-line.conf
./appdir/usr/mnt/TestEdit
./appdir/usr/mnt/TestEdit/Info.txt
./appdir/usr/mnt/TestEdit/TestEdit
./appdir/usr/mnt/TestEdit/TestEdit/Window.hh
./appdir/usr/mnt/TestEdit/TestEdit/Document.hh
./appdir/usr/mnt/TestEdit/TestEdit/App.hh
./appdir/usr/mnt/TestEdit/TestEdit/Window.cc
./appdir/usr/mnt/TestEdit/TestEdit/App.cc
./appdir/usr/mnt/TestEdit/TestEdit/Document.cc
./appdir/usr/mnt/TestEdit/Build-origin.txt
./appdir/usr/mnt/TestEdit/A-line.conf
./appdir/usr/mnt/resources
./appdir/usr/mnt/resources/WDEF-1
./appdir/usr/mnt/resources/WDEF-1/WDEF-1.hh
./appdir/usr/mnt/resources/WDEF-1/A-line.conf
./appdir/usr/mnt/resources/WDEF-1/WDEF-1.cc
./appdir/usr/lib
./appdir/usr/lib/ams-core
./appdir/usr/lib/ams-core/SysError.cc
./appdir/usr/lib/ams-core/Gestalt.hh
./appdir/usr/lib/ams-core/splode.cc
./appdir/usr/lib/ams-core/keycodes.hh
./appdir/usr/lib/ams-core/options.cc
./appdir/usr/lib/ams-core/memwatch.cc
./appdir/usr/lib/ams-core/HandleUtils.hh
./appdir/usr/lib/ams-core/cursor-core.cc
./appdir/usr/lib/ams-core/reactor-core.cc
./appdir/usr/lib/ams-core/interrupt-handlers.hh
./appdir/usr/lib/ams-core/Debugger.hh
./appdir/usr/lib/ams-core/Pointers.hh
./appdir/usr/lib/ams-core/Gestalt.cc
./appdir/usr/lib/ams-core/SysError.hh
./appdir/usr/lib/ams-core/ams-core.cc
./appdir/usr/lib/ams-core/VBL.hh
./appdir/usr/lib/ams-core/cursor-core.hh
./appdir/usr/lib/ams-core/Pointers.cc
./appdir/usr/lib/ams-core/Desk.hh
./appdir/usr/lib/ams-core/OSUtils.hh
./appdir/usr/lib/ams-core/Handles.hh
./appdir/usr/lib/ams-core/Events.hh
./appdir/usr/lib/ams-core/Handles.cc
./appdir/usr/lib/ams-core/options.hh
./appdir/usr/lib/ams-core/HandleUtils.cc
./appdir/usr/lib/ams-core/keycodes.cc
./appdir/usr/lib/ams-core/Patches.hh
./appdir/usr/lib/ams-core/OSEvents.hh
./appdir/usr/lib/ams-core/OSUtils.cc
./appdir/usr/lib/ams-core/VBL.cc
./appdir/usr/lib/ams-core/Desk.cc
./appdir/usr/lib/ams-core/A-line.conf
./appdir/usr/lib/ams-core/OSEvents.cc
./appdir/usr/lib/ams-core/Events.cc
./appdir/usr/lib/ams-core/interrupt-handlers.cc
./appdir/usr/lib/ams-core/Debugger.cc
./appdir/usr/lib/ams-core/reactor-core.hh
./appdir/usr/lib/ams-core/Patches.cc
./appdir/usr/lib/ams-core/splode.hh
./appdir/usr/lib/ams-core/memwatch.hh
./appdir/usr/lib/ams-fs
./appdir/usr/lib/ams-fs/ams-fs.cc
./appdir/usr/lib/ams-fs/MFS.hh
./appdir/usr/lib/ams-fs/MFS.cc
./appdir/usr/lib/ams-fs/mount.cc
./appdir/usr/lib/ams-fs/Files.hh
./appdir/usr/lib/ams-fs/freemount.hh
./appdir/usr/lib/ams-fs/freemount.cc
./appdir/usr/lib/ams-fs/mount.hh
./appdir/usr/lib/ams-fs/Volumes.cc
./appdir/usr/lib/ams-fs/A-line.conf
./appdir/usr/lib/ams-fs/Volumes.hh
./appdir/usr/lib/ams-fs/Files.cc
./appdir/usr/lib/ams-pack
./appdir/usr/lib/ams-pack/Packages.cc
./appdir/usr/lib/ams-pack/Packages.hh
./appdir/usr/lib/ams-pack/ams-pack.cc
./appdir/usr/lib/ams-pack/A-line.conf
./appdir/usr/lib/ams-qd
./appdir/usr/lib/ams-qd/redraw_lock.hh
./appdir/usr/lib/ams-qd/StrUtils.cc
./appdir/usr/lib/ams-qd/Pictures.hh
./appdir/usr/lib/ams-qd/Text.hh
./appdir/usr/lib/ams-qd/Fixed.hh
./appdir/usr/lib/ams-qd/StrUtils.hh
./appdir/usr/lib/ams-qd/draw.hh
./appdir/usr/lib/ams-qd/InitGraf.hh
./appdir/usr/lib/ams-qd/Fonts.cc
./appdir/usr/lib/ams-qd/OvalRgn.hh
./appdir/usr/lib/ams-qd/RoundRectRgn.hh
./appdir/usr/lib/ams-qd/OpenPoly.cc
./appdir/usr/lib/ams-qd/Ovals.hh
./appdir/usr/lib/ams-qd/Polygons.hh
./appdir/usr/lib/ams-qd/Fonts.hh
./appdir/usr/lib/ams-qd/Rects.cc
./appdir/usr/lib/ams-qd/circular_region.hh
./appdir/usr/lib/ams-qd/Region-ops.cc
./appdir/usr/lib/ams-qd/Rect-utils.cc
./appdir/usr/lib/ams-qd/circular_region.cc
./appdir/usr/lib/ams-qd/redraw_lock.cc
./appdir/usr/lib/ams-qd/Pen.cc
./appdir/usr/lib/ams-qd/Points.cc
./appdir/usr/lib/ams-qd/GrafPorts.hh
./appdir/usr/lib/ams-qd/Ovals.cc
./appdir/usr/lib/ams-qd/draw.cc
./appdir/usr/lib/ams-qd/Cursor.cc
./appdir/usr/lib/ams-qd/Text.cc
./appdir/usr/lib/ams-qd/GrafPorts.cc
./appdir/usr/lib/ams-qd/Pen.hh
./appdir/usr/lib/ams-qd/RoundRects.hh
./appdir/usr/lib/ams-qd/Fixed.cc
./appdir/usr/lib/ams-qd/QDUtils.hh
./appdir/usr/lib/ams-qd/OpenPoly.hh
./appdir/usr/lib/ams-qd/Rect-utils.hh
./appdir/usr/lib/ams-qd/ams-qd.cc
./appdir/usr/lib/ams-qd/OvalRgn.cc
./appdir/usr/lib/ams-qd/Regions.cc
./appdir/usr/lib/ams-qd/Rects.hh
./appdir/usr/lib/ams-qd/Regions.hh
./appdir/usr/lib/ams-qd/A-line.conf
./appdir/usr/lib/ams-qd/CopyBits.hh
./appdir/usr/lib/ams-qd/Polygons.cc
./appdir/usr/lib/ams-qd/Pictures.cc
./appdir/usr/lib/ams-qd/Cursor.hh
./appdir/usr/lib/ams-qd/CopyBits.cc
./appdir/usr/lib/ams-qd/QDUtils.cc
./appdir/usr/lib/ams-qd/Points.hh
./appdir/usr/lib/ams-qd/InitGraf.cc
./appdir/usr/lib/ams-qd/RoundRects.cc
./appdir/usr/lib/ams-qd/Region-ops.hh
./appdir/usr/lib/ams-qd/RoundRectRgn.cc
./appdir/usr/lib/ams-ui
./appdir/usr/lib/ams-ui/StrUtils.cc
./appdir/usr/lib/ams-ui/Icons.cc
./appdir/usr/lib/ams-ui/StrUtils.hh
./appdir/usr/lib/ams-ui/Drag.cc
./appdir/usr/lib/ams-ui/scoped_port.hh
./appdir/usr/lib/ams-ui/desktop.cc
./appdir/usr/lib/ams-ui/Drag.hh
./appdir/usr/lib/ams-ui/CDEF.hh
./appdir/usr/lib/ams-ui/BinaryDecimal.cc
./appdir/usr/lib/ams-ui/Controls.hh
./appdir/usr/lib/ams-ui/WDEF.hh
./appdir/usr/lib/ams-ui/modal_updating.hh
./appdir/usr/lib/ams-ui/Icons.hh
./appdir/usr/lib/ams-ui/modal_updating.cc
./appdir/usr/lib/ams-ui/WDEF.cc
./appdir/usr/lib/ams-ui/Dialogs.cc
./appdir/usr/lib/ams-ui/TextEdit.hh
./appdir/usr/lib/ams-ui/CDEF.cc
./appdir/usr/lib/ams-ui/Menus.cc
./appdir/usr/lib/ams-ui/Controls.cc
./appdir/usr/lib/ams-ui/MDEF.cc
./appdir/usr/lib/ams-ui/Windows.cc
./appdir/usr/lib/ams-ui/Dialogs.hh
./appdir/usr/lib/ams-ui/Menus.hh
./appdir/usr/lib/ams-ui/A-line.conf
./appdir/usr/lib/ams-ui/MDEF.hh
./appdir/usr/lib/ams-ui/desktop.hh
./appdir/usr/lib/ams-ui/ams-ui.cc
./appdir/usr/lib/ams-ui/MBDF.cc
./appdir/usr/lib/ams-ui/MBDF.hh
./appdir/usr/lib/ams-ui/BinaryDecimal.hh
./appdir/usr/lib/ams-ui/TextEdit.cc
./appdir/usr/lib/ams-ui/Windows.hh
./appdir/usr/lib/ams-seg
./appdir/usr/lib/ams-seg/options.cc
./appdir/usr/lib/ams-seg/Segments.hh
./appdir/usr/lib/ams-seg/options.hh
./appdir/usr/lib/ams-seg/ams-seg.cc
./appdir/usr/lib/ams-seg/A-line.conf
./appdir/usr/lib/ams-seg/Segments.cc
./appdir/usr/lib/ams-rsrc
./appdir/usr/lib/ams-rsrc/ams-rsrc.cc
./appdir/usr/lib/ams-rsrc/rsrc_fork.hh
./appdir/usr/lib/ams-rsrc/Resources.hh
./appdir/usr/lib/ams-rsrc/A-line.conf
./appdir/usr/lib/ams-rsrc/Resources.cc
./appdir/usr/lib/ams-io
./appdir/usr/lib/ams-io/Devices.hh
./appdir/usr/lib/ams-io/UnitTable.hh
./appdir/usr/lib/ams-io/options.cc
./appdir/usr/lib/ams-io/Devices.cc
./appdir/usr/lib/ams-io/ams-io.cc
./appdir/usr/lib/ams-io/Sound.cc
./appdir/usr/lib/ams-io/Sound.hh
./appdir/usr/lib/ams-io/Console.hh
./appdir/usr/lib/ams-io/DRVR.cc
./appdir/usr/lib/ams-io/options.hh
./appdir/usr/lib/ams-io/Console.cc
./appdir/usr/lib/ams-io/A-line.conf
./appdir/usr/lib/ams-io/DRVR.hh
./appdir/usr/lib/ams-io/UnitTable.cc

Can be downloaded here: https://github.com/probonopd/metamage_1/releases/download/continuous/appdir.tar.bz2

Thanks.

probonopd commented 5 years ago

What do I need to run/launch so that I get a Mac application running in an X window on a user's machine given the above AppDir?

probonopd commented 5 years ago

In https://www.v68k.org/advanced-mac-substitute/howto/ make is used for running things. I am looking for a solution to run things that does not need developer tools such as make.

curl -LO https://archive.org/download/mac_Lode_Runner/Lode_Runner.dsk
mv Lode_Runner.dsk ../ams-68k-bin/mnt/
AMS_DISK=Lode_Runner.dsk AMS_APPNAME="Lode Runner" make ams-osx

I am looking for something like

curl -LO https://archive.org/download/mac_Lode_Runner/Lode_Runner.dsk
./appdir/usr/bin/????? /home/me/Downloads/Lode_Runner.dsk "Lode Runner"

./appdir/usr/bin/????? is the (missing) main launcher script ("interpreter") (can be converted from the Makefile?)?

Also, instead of (what I figured from the Makefile)

utils/pack.pl v68k/demos/hello.p68k | var/build/dbg/bin/d68k/d68k

I am looking for something that does not need Perl.

probonopd commented 5 years ago

Seems like something like

AMS_APPNAME=Tic-tac-toe EXHIBIT_INTERACT=interact-x11 PATH="$PWD/bin:$PWD/var/out:$PATH" AMS_BIN=var/links/ams-68k-bin/bin AMS_LIB=var/links/ams-68k-bin/lib AMS_MNT=var/links/ams-68k-bin/mnt ./scripts/ams

will do...

jjuran commented 5 years ago

For the 68K components, you need binaries, not source. That's what the ams-68k-bin repository is for.

jjuran commented 5 years ago

Also, anything 68K should go into appdir/usr/share/ams/{bin,lib,mnt}.

probonopd commented 5 years ago

This works for me:

./usr/share/ams/mnt/Lode_Runner.dsk
./usr/share/ams/mnt/AMS Resources/r/000c.FONT
./usr/share/ams/mnt/AMS Resources/r/0004.CURS
./usr/share/ams/lib/ams-ui
./usr/share/ams/lib/ams-seg
./usr/share/ams/lib/ams-rsrc
./usr/share/ams/lib/ams-qd
./usr/share/ams/lib/ams-pack
./usr/share/ams/lib/ams-io
./usr/share/ams/lib/ams-fs
./usr/share/ams/lib/ams-core
./usr/share/ams/bin
./usr/bin/xv68k
./usr/bin/vxz
./usr/bin/vx
./usr/bin/raster
./usr/bin/interact-x11
./usr/bin/graft
./usr/bin/freemountd
./usr/bin/exhibit
./usr/bin/app
./usr/bin/ams
./ams-x11.png
./ams-x11.desktop
./AppRun

I am using this as my AppRun launcher script:

#!/bin/bash

HERE="$(dirname "$(readlink -f "${0}")")"
export PATH="$HERE/usr/bin:$PATH"

AMS_DISK="Lode_Runner.dsk" AMS_APPNAME="Lode Runner" EXHIBIT_INTERACT=interact-x11 ams

To make this work, I have to

curl -LO https://archive.org/download/mac_Lode_Runner/Lode_Runner.dsk
mv Lode_Runner.dsk ./usr/share/ams/mnt/

# Fix troublesome filename with blank character
rm AppDir/usr/bin/ams ; mv AppDir/usr/v/bin/ams.vx AppDir/usr/bin/ams ; rm -r AppDir/usr/v
mv AppDir/usr/bin/vx\ -Z AppDir/usr/bin/vxz
sed -i -e 's|vx -Z|vxz|g' AppDir/usr/bin/ams
probonopd commented 5 years ago

Why does the disk image need to reside in a specific location? I need to be able to store disk images outside of the AppDir...

jjuran commented 5 years ago

app is a 68K-compiled command-line tool and belongs in usr/share/ams/bin, not usr/bin.

jjuran commented 5 years ago

The disk image is mounted by the emulated File Manager reimplementation, and emulated code can't access the native file system so it has to work through a file server (freemountd). (I agree that this is a suboptimal restriction, and I'm open to ideas on how to remove it.)

However, you can place the Freemount root anywhere you'd like, and symlinks that point outside of that root will appear to clients as the linked item — so you could have applications and AMS Resources in different locations. (Again, this is admittedly less flexible than it could be, and I'm open to ideas.)

probonopd commented 5 years ago

usr/share/ams/bin, not usr/bin

I did not understand the difference between the two, and set a symlink from usr/share/ams/bin to usr/bin...

jjuran commented 5 years ago

usr/bin is for native binaries, like xv68k itself. usr/share/ams/bin as for 68K-compiled binaries that will be executed by xv68k. The only one relevant is app, which basically just calls the Mac OS _Launch trap (implemented in ams-seg).

probonopd commented 5 years ago

Thanks for your explanations. I think I understand it halfway now.

Would it be possible to have a make install that would create such a directory structure?

Something similar to

./configure --prefix=/usr
make
make install DESTDIR=./appdir

appdir/usr/bin
appdir/usr/share
...
jjuran commented 5 years ago

I pushed a change to the Makefile that adds an ams-x11-install target. It currently relies on the var/install symlink, so by deleting and recreating it after running ./configure and before running make ams-x11-install, you can control the dest dir.

Ultimately, I'd like to give AMS its own proper Makefile. The first step is choosing a directory for it.

probonopd commented 5 years ago

Thank you very much for your help. It's all sorted out now.