emaculation / SheepShaver

MacOS run-time environment for BeOS and Linux
GNU General Public License v2.0
14 stars 3 forks source link

Factor all duplicate files into a shared library. #15

Closed ianfixes closed 5 years ago

ianfixes commented 5 years ago

Creating a shared library seems to be the best path forward for deduplicating the 226 files in BasiliskII that are used directly by Sheepshaver.

Encoded paths

These files contain references to BasiliskII files, found using

ag -l '\.\.\/BasiliskII' SheepShaver | awk '{print "- [ ] `" $1 "`"}'`  

Symlinked files

Note to self: this listing doesn't properly handle printing the full source subdirectories

To generate this list of symlinks that need to be deduplicated, it's 3 steps:

# 1. get the repo that we'll be migrating from (assume rev `c3e312f`)
git clone https://github.com/kanjitalk755/macemu

# 2. make a copy, the effect of which is replacing all symlinks
#     with copies of their targets
cp -r macemu macemu_migration

# 3. draw the rest of the owl
cd macemu_migration
git status | grep "^\t" | awk '{print $2}' | xargs -I{} echo "dirname {}" | sh | sort | uniq | xargs -I{} echo "cd ../BasiliskII && ls -l {}/*" | sh | grep -- "->" | awk '{print "- [ ] " $9 " " $10 " " $11}'

Symlinked directories

To generate this list of symlinks that need to be deduplicated, it's 3 steps:

# 1. get the repo that we'll be migrating from (assume rev `c3e312f`)
git clone https://github.com/kanjitalk755/macemu

# 2. make a copy, the effect of which is replacing all symlinks
#     with copies of their targets
cp -r macemu macemu_migration

# 3. draw the rest of the fucking owl
git status |grep deleted| grep "^\t" | awk '{print "cd ../BasiliskII && ls -ld  " $2}' | sh | awk "{print \"sh -c 'cd \" \$9 \" && find . -type f | xargs -I{} echo \\\"\" \$9 \"/{} \" \$11 \"/{}\\\" '\" }"  | sh | sed -e 's|/./|/|g' | awk '{print "- [ ] `" $1 "` `" $2 "`"}'
retokromer commented 5 years ago

Thank you very much indeed for this!

A little historical context, in case it’s not already clear. There are:

  1. ShapeShifter (1995–2001) is a Classic Mac OS (680x0) emulator for AmigaOS. This explains the presence of Amiga.

  2. Basilisk II (1997–«2006») is a Classic Mac OS (680x0) cross-platform emulator. For many years this was the Classic Mac OS 680x0 emulator.

  3. SheepShaver (1998–«2006») is a Classic Mac OS (PowerPC) emulator, originally for BeOS but became rapidly cross-platform. This explains the presence of BeOS. In this emulator it is possible to include the functionalities of Basilisk II, in order to be able to emulate Classic Mac OS on both 680x0 and PowerPC architectures.

I do personally use as well Mini vMac for 680x0 and QEMU for PowerPC, mainly for preservation of computer art. And to me, to be honest, QEMU is the better emulator, even if I did actually use more SheepShaver.

In my opinion, SheepShaver is a solid emulator and we should focus our work on it. The information you posted here goes exactly in that direction. I suggest to skip the support for AmigaOS, BeOS et al., and to focus our work on supporting macOS, Linux and Windows. Still in my opinion, once we have a solid new release, we should then focus on improving the code for modern x86_64 architectures, because currently it runs much slower than on PowerPC architectures.

I hope this is useful.

ianfixes commented 5 years ago

I'm going to pose this question to a few more folks, but what should the shared library be called? libBasiliskII ?

retokromer commented 5 years ago

I would suggest to avoid capital letters.

ianfixes commented 5 years ago

I'm looking for best practices on how to split a project into a library and frontend. Found these:

I've used cmake before on several occasions, one was in normal C++ development and another time was replacing a very convoluted set of Makefiles for an ancient Fortran project (like, Makefiles that generated other Makefiles and then ran them). I'm inclined to use it here as well, unless there are objections.

ianfixes commented 5 years ago

After some initial testing and some side-band conversations, I'm questioning whether splitting these 2 (with our without a shared library) is still the best path forward. It might be best to move forward by rebooting my own effort (splitting cxmon out, but leaving BasiliskII and SheepShaver joined) and re-applying all the work from both repos into that.

To save some effort on my part, I would be renaming the BasiliskII github repo to macemu, migrating all issues from this repo to the other one, and then removing his repo. I'm going to sleep on it, but that's the plan at present.

Long story short, I can't think of a way to "safely" accomplish the split -- in other words, to get working CI before, during, and after a major refactor of components that didn't have CI to begin with. It might make sense to split later, but my entire reason for splitting was based on the faulty assumption that it would only be as hard as #3 .

retokromer commented 5 years ago

To me it makes sense to split Basilisk II (emulator of Classic Mac OS on 680x0 architectures) and SheepShaver (emulator of Classic Mac OS on PowerPC architectures).

cxmon is a tool used for programming and testing assembler for Basilisk, if I remember carefully.

ianfixes commented 5 years ago

I agree with the principle of that (as you saw, it was my first action upon working with this repo), but both emulators share a large chunk of codebase -- which includes portions of the OS-specific codebases. Is there a simple way to factor out the common files that I'm overlooking?

retokromer commented 5 years ago

No, sorry, I’m afraid, I don’t see a simple way, but in my opinion this separation would be a big step and simplify the future maintenance.

ianfixes commented 5 years ago

After some experimentation and consideration, I'm going to archive this project unless/until splitting it looks more feasible. This morning I was able to apply all the work we've done on the split (Basilisk & SheepShaver) repositories to a single "macemu-minus-cxmon" repo. I will force-push that to the BasiliskII repo and rename that repo macemu (to be more compatible with the original project). Renaming that repo also keeps all the existing issues I've created there as well as any discussion.

I will copy issues #8 and #10 to the other repo.

I'm not ruling out a split of these 2 projects in the future, but as of this writing I've been unable to find a path forward that begins with the hard split -- too many unknowns all at once, particularly in refactoring the build system. It's far from impossible, but absolutely impractical.