Skip to content

armgit / xtool

Public Imported from GitHub
0

Cross-platform Xcode replacement. Build and deploy iOS apps with SwiftPM on Linux, Windows, macOS.

Docker and Linux

Kabir Oberai6a59e7ad2e86
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..dbd7adb
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,91 @@
+# Note: We use 20.04 since AppImage recommends building on the
+# oldest configuration that you support
+
+FROM ubuntu:focal AS limd-build
+
+RUN apt-get update \
+ && apt-get install -y --no-install-recommends \
+ ca-certificates \
+ build-essential \
+ checkinstall \
+ git \
+ autoconf \
+ automake \
+ libtool-bin \
+ libssl-dev \
+ pkg-config \
+ libcurl4-openssl-dev \
+ && rm -rf /var/lib/apt/lists/*
+
+RUN mkdir /prefix
+
+RUN git clone https://github.com/libimobiledevice/libplist.git \
+ && cd libplist \
+ && ./autogen.sh --prefix /usr --without-cython \
+ && make \
+ && make install \
+ && make install DESTDIR=/prefix \
+ && cd .. \
+ && rm -rf libplist
+
+RUN git clone https://github.com/libimobiledevice/libimobiledevice-glue.git \
+ && cd libimobiledevice-glue \
+ && ./autogen.sh --prefix /usr \
+ && make \
+ && make install \
+ && make install DESTDIR=/prefix \
+ && cd .. \
+ && rm -rf libimobiledevice-glue
+
+RUN git clone https://github.com/libimobiledevice/libusbmuxd.git \
+ && cd libusbmuxd \
+ && ./autogen.sh --prefix /usr \
+ && make \
+ && make install \
+ && make install DESTDIR=/prefix \
+ && cd .. \
+ && rm -rf libusbmuxd
+
+RUN git clone https://github.com/libimobiledevice/libtatsu.git \
+ && cd libtatsu \
+ && ./autogen.sh --prefix /usr \
+ && make \
+ && make install \
+ && make install DESTDIR=/prefix \
+ && cd .. \
+ && rm -rf libtatsu
+
+RUN git clone https://github.com/libimobiledevice/libimobiledevice.git \
+ && cd libimobiledevice \
+ && ./autogen.sh --prefix /usr --without-cython --enable-debug \
+ && make \
+ && make install \
+ && make install DESTDIR=/prefix \
+ && cd .. \
+ && rm -rf libimobiledevice
+
+
+FROM swift:6.0-focal
+
+RUN apt-get update \
+ && apt-get install -y --no-install-recommends \
+ curl \
+ libssl-dev \
+ ca-certificates \
+ zip unzip \
+ && rm -rf /var/lib/apt/lists/*
+
+
+COPY --from=limd-build /prefix/usr /usr
+
+# Docker doesn't support FUSE
+ENV APPIMAGE_EXTRACT_AND_RUN=1
+
+# Use the host's usbmuxd.
+# You probably want to use socat on the host to forward this port to /var/run/usbmuxd:
+# socat -dd TCP-LISTEN:27015,range=127.0.0.1/32,reuseaddr,fork UNIX-CLIENT:/var/run/usbmuxd
+ENV USBMUXD_SOCKET_ADDRESS=host.docker.internal:27015
+
+WORKDIR /Supersign
+
+ENTRYPOINT [ "/bin/bash" ]
diff --git a/Linux/.gitignore b/Linux/.gitignore
new file mode 100644
index 0000000..c3ff646
--- /dev/null
+++ b/Linux/.gitignore
@@ -0,0 +1,5 @@
+/packages
+/staging
+/storage
+appimage-build
+AppDir
diff --git a/Linux/README.md b/Linux/README.md
new file mode 100644
index 0000000..09029aa
--- /dev/null
+++ b/Linux/README.md
@@ -0,0 +1,24 @@
+# Supersign + Linux = <3
+
+Supersign currently uses AppImage to build its Linux CLI. It is possible to build and run the AppImage on a native Linux host, as well as through Docker (natively or through Docker Desktop on macOS).
+
+## Setup
+
+Make sure `usbmuxd` is installed on your host machine. On macOS, `usbmuxd` is preinstalled.
+
+### Using Docker
+
+You can build and run a container with standard Docker Compose commands, for example:
+```
+docker compose run --rm supersign
+```
+This will spawn a shell inside the container. The Supersign root directory will be bind-mounted at `/Supersign`.
+
+To actually access iOS devices from inside Docker, you'll also need to forward the host's `usbmuxd` to a port which the Docker container's libusbmuxd will connect to. Keep this command running on your host machine:
+```
+socat -dd TCP-LISTEN:27015,range=127.0.0.1/32,reuseaddr,fork UNIX-CLIENT:/var/run/usbmuxd
+```
+
+## Building
+
+Simply run `./build.sh` in this directory. This will output an AppImage to `packages/Supersign.AppImage`, which can directly be invoked.
diff --git a/Linux/Supersign.desktop b/Linux/Supersign.desktop
new file mode 100644
index 0000000..9938068
--- /dev/null
+++ b/Linux/Supersign.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Version=1.0
+Type=Application
+Name=Supersign
+Categories=Development;
+Exec=SupersignCLI
+Icon=Supersign
+# TODO: remove
+Terminal=true
diff --git a/Linux/Supersign.png b/Linux/Supersign.png
new file mode 100644
index 0000000..a0c6b1f
Binary files /dev/null and b/Linux/Supersign.png differ
diff --git a/Linux/build.sh b/Linux/build.sh
new file mode 100755
index 0000000..7bd25c4
--- /dev/null
+++ b/Linux/build.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+set -e
+shopt -s nullglob
+
+# installer version
+export VERSION="1.0.0"
+
+if ! command -v fusermount &>/dev/null; then
+ # Docker doesn't support FUSE
+ export APPIMAGE_EXTRACT_AND_RUN=1
+fi
+
+rm -rf staging
+mkdir staging
+
+swift build --package-path .. -c release --product SupersignCLI --static-swift-stdlib
+bin="$(swift build --package-path .. -c release --show-bin-path)"
+strip "${bin}/SupersignCLI"
+
+curl "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-$(arch).AppImage" \
+ -Lo staging/linuxdeploy.AppImage
+chmod +x staging/linuxdeploy.AppImage
+
+mkdir -p staging/AppDir/usr/bin
+find "${bin}"/ -name '*.resources' -print0 | xargs -0 -I {} cp -a {} "${PWD}/staging/AppDir/usr/bin/"
+
+OUTPUT="staging/Supersign.AppImage" ./staging/linuxdeploy.AppImage \
+ --appdir staging/AppDir \
+ --output appimage \
+ -e "${bin}/SupersignCLI" \
+ -d Supersign.desktop \
+ -i Supersign.png
+mkdir -p packages
+mv -f staging/Supersign.AppImage packages/Supersign.AppImage
+
+rm -rf staging
+
+echo "[info] Success!"
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..47f53d1
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,18 @@
+services:
+ supersign:
+ build:
+ context: .
+ volumes:
+ - .:/Supersign
+ container_name: supersign
+ stdin_open: true
+ tty: true
+ cap_add:
+ - sys_ptrace
+ security_opt:
+ - seccomp:unconfined
+ extra_hosts:
+ # host.docker.internal doesn't exist by default on Linux hosts
+ # TODO: Does this conflict with the default host on macOS?
+ # we could rename this
+ - "host.docker.internal:host-gateway"