Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support data.tar.gz #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

support data.tar.gz #25

wants to merge 1 commit into from

Conversation

rsteube
Copy link

@rsteube rsteube commented May 31, 2024

I had a deb with data.tar.gz instead of data.tar.xz which caused an error.

caarlos0 pushed a commit to goreleaser/goreleaser that referenced this pull request Jun 11, 2024
This adds `arm` support for termux (arch needs to be called `arm` as
well).

---

Ok this drove me nuts, but I think I've got it working now:
https://github.com/carapace-sh/carapace-bin/releases/tag/v1.0.3

1.  First of all most of the `android` targets need `CGO_ENABLED=1`.

2. Then there's the need for a [patched
runtime](https://github.com/carapace-sh/go/tree/master/termux) due to
the `/data/data/com.termux/files` prefix (adopted from the [golang
package](https://github.com/termux/termux-packages/tree/master/packages/golang)).

3. Two builds so that for termux the patched `gobinary` can be used.
Then add a `termux` suffix to the archives for clarity.

```yaml
builds:
  - id: default
    env:
      - CGO_ENABLED=0
    goos:
      - linux
      - windows
      - darwin
    main: ./cmd/carapace
    binary: carapace
    tags:
      - release
  - id: termux
    env:
      - CGO_ENABLED=1
    goos:
      - android
    goarch:
      - amd64
      - arm64
      - arm
      - "386"
    main: ./cmd/carapace
    binary: carapace
    tags:
      - release
    gobinary: go-termux
archives:
  - name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
    builds:
     - default
    format_overrides:
      - goos: windows
        format: zip
  - id: termux
    builds:
      - termux
    name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}.termux'
```

4. Compiling needs the [Android NDK](https://developer.android.com/ndk)
with the `CC` environment variable set. I used a
[script](https://github.com/carapace-sh/go/blob/master/go-termux.sh) for
this (`/usr/local/bin/go-termux`).

```sh
#!/bin/bash

bindir="/opt/android-sdk/ndk/${NDK_VERSION}/toolchains/llvm/prebuilt/linux-x86_64/bin"
[ "$GOARCH" = "amd64" ] && export CC="$bindir/x86_64-linux-android${ANDROID_VERSION}-clang"
[ "$GOARCH" = "arm64" ] && export CC="$bindir/aarch64-linux-android${ANDROID_VERSION}-clang"
[ "$GOARCH" = "arm" ] && export CC="$bindir/armv7a-linux-androideabi${ANDROID_VERSION}-clang"
[ "$GOARCH" = "386" ] && export CC="$bindir/i686-linux-android${ANDROID_VERSION}-clang"

exec /usr/local/go-termux/bin/go "$@"
```

5. There's [termux-apt-repo](https://github.com/termux/termux-apt-repo)
which makes repo creation pretty easy with `gh_pages`. Just needs a
[fix](termux/termux-apt-repo#25) as goreleaser
uses `data.tar.gz`.

related #3333
related #4812 
related termux/termux-apt-repo#25
@aicynide
Copy link

aicynide commented Sep 2, 2024

@Tomio please merge it

@aicynide
Copy link

aicynide commented Sep 2, 2024

@TomJo2000

@TomJo2000
Copy link
Member

I have no maintainer powers in this repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants