phoenixframework / tailwind

An installer for tailwind
MIT License
467 stars 61 forks source link

Support for FreeBSD #49

Open marschro opened 2 years ago

marschro commented 2 years ago

Hi all, I posted this discussion in the tailwind repo: https://github.com/tailwindlabs/tailwindcss/discussions/7826

There is currently no binary for freebsd and I relay like to use phoenixframework/tailwind as well as I love my FreeBSD servers.

I tried to compile the source with vercel/pkg but did not succeed. Is there anyone else out there who needs a FreeBSD binary and more knowledge about how to compile that? kind regards!

dch commented 1 year ago

A quick update, after many peoples help we now can build this for FreeBSD :tada: which I will import into FreeBSD ports :soon:

There is no easy way to do github actions with FreeBSD, I'm not keen on burning cycles to figure out some hacky work-around abusing virtualbox or qemu.

The FreeBSD ports & package system is going to be the way most Elixir users will install both Elixir and Erlang, would Phoenix be OK with teaching the tailwind module, for FreeBSD, to tell people to fetch this via official packages, rather than from the tailwind repos?

chrismccord commented 1 year ago

@dch what would that look like? Downloading from a different source or raising a helpful error for freebsd usage with custom instructions?

dch commented 1 year ago

@chrismccord sorry for the delayed reply. I've not had this building inside a no-net container yet, which is a requirement for building inside ports - somewhere in the 70+Mb of downloaded javascripts is an assumption that there must be a reachable network.

In the interim, are we able to download from e.g. https://people.freebsd.org/~dch/pub/tailwind/tailwindcss-v3.2.4-freebsd-x64.xz, with a suitable checksum?

Or, I can set up some sort of build script that generates these artefacts through an inspectable build log, and then use that?

Finally, we can offload this trust choice to users and point them towards that URL with some warnings about strange people on the internet.

I'm not planning to spend my Christmas vacation hacking javascripts packaging tools, when I could be playing with LiveView.

What's an appropriate level of trust?

marschro commented 1 year ago

Wohooo !!! @chrismccord and @dch So is it real now ? https://hexdocs.pm/tailwind/changelog.html#v0-1-10-2023-02-09

SukhikhN commented 8 months ago

Tailwind tasks doesn't work for me: ** (Mix)mix tailwind default --minifyexited with 8 on my machine:

> uname -srm
FreeBSD 13.1-RELEASE-p8 amd64

with Erlang 26.0.2.

It downloads tailwind binary for Linux instead of FreeBSD.

This is because this code https://github.com/phoenixframework/tailwind/blob/2298fd3f119ac3487cf400f6775781585f8741ec/lib/tailwind.ex#L248 returns "x86_64" on my machine, not "amd64". The cause for this bevahior seems to be here: https://github.com/erlang/otp/blob/14ce71d439bef11fd54a214b0d408bc75dee6ec2/erts/autoconf/config.guess#L877

So the arch string should be fixed here https://github.com/phoenixframework/tailwind/blob/2298fd3f119ac3487cf400f6775781585f8741ec/lib/tailwind.ex#L255 if someone can confirm that on all supported FreeBSD and Erlang versions it will be "x86_64".

dch commented 8 months ago

@SukhikhN the most common case is installing OTP via binary package, which gives us:

$ which erl; uname -p; elixir --eval 'IO.puts(:erlang.system_info(:system_architecture))'
/usr/local/lib/erlang26/bin/erl
amd64
amd64-portbld-freebsd15.0

how did you install Erlang/OTP? what do you get instead?

We may need to PR both cases.

Assuming you used asdf, I tried installing erlang latest, and get an unrelated error atm:

...
 CC     /home/dch/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.2/otp_src_26.1.2/erts/emulator/ryu/obj/x86_64-unknown-freebsd15.0/opt/d2s.o
 CXX    obj/x86_64-unknown-freebsd15.0/opt/jit/beam_asm_global.o
<command-line>: sorry, unimplemented: PCH allocation failure
gmake[4]: *** [x86_64-unknown-freebsd15.0/Makefile:936: obj/x86_64-unknown-freebsd15.0/opt/jit/beam_asm_global.o] Error 1
gmake[4]: *** Waiting for unfinished jobs....

Currently built tailwind versions:

I use mix tailwind.install --if-missing https://people.freebsd.org/~dch/pub/tailwind/v3.3.2/tailwindcss-freebsd-x64 to fetch it.

You will also need lang/gcc installed for tailwind to run.

SukhikhN commented 8 months ago

Yes, I have Erlang 26.0.2 installed using asdf.

Here is the system info:

$ which erl; uname -p; elixir --eval 'IO.puts(:erlang.system_info(:system_architecture))'
/home/freebsd/.asdf/shims/erl
amd64
x86_64-unknown-freebsd13.1
dch commented 8 months ago

@SukhikhN perhaps PR for this?

{{:unix,:freebsd}, arch, 64} when arch in ~w(x86_64 amd64) -> "freebsd-x64"

SukhikhN commented 1 month ago

Could this #95 be merged please?