BlockchainCommons / bc-lifehash

A beautiful method of hash visualization based on Conway’s Game of Life: reference library in C/C++
Other
30 stars 8 forks source link

Linux support and CI #2

Closed gorazdko closed 3 years ago

gorazdko commented 3 years ago

@wolfmcnally can you review and merge

Needed, see https://github.com/BlockchainCommons/bc-sskr/issues/3#issuecomment-789092258

AndreasGassmann commented 3 years ago

If this is the expected output, then I can confirm that this fix works for me:

vscode ➜ /workspaces/bc-lifehash (linux-support ✗) $ make
cd src && make all
make[1]: Entering directory '/workspaces/bc-lifehash/src'
ar rcs -o liblifehash.a bit-aggregator.o bit-enumerator.o cell-grid.o color.o color-func.o color-grid.o format-utils.o gradients.o hsb-color.o lifehash.o memzero.o patterns.o point.o sha256.o
make[1]: Leaving directory '/workspaces/bc-lifehash/src'
cd test && make all
make[1]: Entering directory '/workspaces/bc-lifehash/test'
cc -g -O0   -c -o testc.o testc.c
cc   testc.o ../src/liblifehash.a  -L../src -llifehash -lstdc++ -lm -o testc
g++    -c -o test.o test.cpp
cc   test.o ../src/liblifehash.a  -L../src -llifehash -lstdc++ -lm -o test
make[1]: Leaving directory '/workspaces/bc-lifehash/test'
gorazdko commented 3 years ago

If this is the expected output, then I can confirm that this fix works for me

yes it's correct. If you also run make check the tests will be run.

ChristopherA commented 3 years ago

Shouldn't both zsh and bash do the right thing if the script has the header info correct?

#!/bin/zsh

#!/bin/bash

wolfmcnally commented 3 years ago

Shouldn't both zsh and bash do the right thing if the script has the header info correct?

#!/bin/zsh

#!/bin/bash

Bash and Zsh are very different in some important ways. They are not simply interchangeable. I have switched to Zsh for writing build scripts, especially because dealing with file paths under Zsh is actually a lot more straightforward, and I'm not going to guarantee or approve scripts I've written and tested under Zsh being slammed over to Bash.

gorazdko commented 3 years ago

Closing as I will not be supporting zsh with Linux

wolfmcnally commented 3 years ago

Closing as I will not be supporting zsh with Linux

Why not? It's only for the build script. And all my build scripts are going to be migrated to Zsh eventually because they're far easier to maintain.

ChristopherA commented 3 years ago

I believe (but don't know) that Debian and most distributions come with zsh now. Mac one has a very old bash and refuses to update it. If you were to tell me that Debian didn't have curren tzsh, I'd say we'd have to support the least common denominator.

gorazdko commented 3 years ago

The majority of devices/platforms do not come preinstalled with zsh, they do come with bash.

I've added new commits to support zsh. I dont see the benfits of zsh outweighing the costs though (changing all the repos, setting windows cross compiler, new bugs, is the change easy to adopt when cross compiling to xyz platform)

But I'll let you guys decide.

And all my build scripts are going to be migrated to Zsh eventually because they're far easier to maintain.

If you're going to do that make sure you're adding the extra 2 lines (these: https://github.com/BlockchainCommons/bc-lifehash/pull/2/commits/17fb855541565120b774a5434a4dd47084c13b9b) in every repo you are changing to make the linux build pass.

wolfmcnally commented 3 years ago

@gorazdko Just so you know I have my reasons: not every script cares about this, but I've run across it enough that for my own coding (and promotion of better tech) I'm choosing Zsh over Bash, primarily for these reasons excerpted below: