diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 58ec01d..24c48df 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,161 +1,39 @@ -name: Build AltServer - on: - push: workflow_dispatch: - inputs: - sync_upstream: - required: false - default: false - debug_enabled: - description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' - required: false - default: false - repository_dispatch: - - schedule: - - cron: "0 */4 * * *" # min hour day week year - - -env: - REGISTRY: ghcr.io + push: + branches: ["**"] + paths-ignore: + - "**/*.md" +name: Build Binary jobs: - check: - runs-on: ubuntu-latest - name: "Check Upstream Updates" - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - submodules: recursive - - - name: Check If Need Checking - id: needCheck - if: ${{ github.event_name == 'schedule' || ( github.event_name == 'workflow_dispatch' && github.event.inputs.sync_upstream ) }} - run: | - echo "needCheck=1" >> $GITHUB_ENV - - - name: Check Upstream Version - id: check - run: | - if [[ "$needCheck" == 1 ]]; then - echo "Checking changes in upstream_repo..." - - current_upstream=$(git ls-tree HEAD upstream_repo | awk '{ print $3 }') - echo "Current Upstream Commit: $current_upstream" - - git submodule update --remote -- upstream_repo - new_upstream=$( cd upstream_repo; git show -s --format=%H ) - echo "New Upstream Commit: $new_upstream" - - git reset --hard - git submodule update --init - if [[ "$current_upstream" != "$new_upstream" ]]; then - echo "Upstream got new commits, go updating!" - echo "::set-output name=updated::1" - else - echo "Upstream no change~" - echo "::set-output name=updated::0" - fi - else - echo "Needn't to check changes, directly return~" - echo "::set-output name=updated::0" - fi - - - uses: gautamkrishnar/keepalive-workflow@master - with: - commit_message: "[proj] keepalive-workflow auto commit" - outputs: - updated: ${{ steps.check.outputs.updated }} - build: - needs: [check] + runs-on: ubuntu-latest + container: greyltc/archlinux-aur:paru strategy: + fail-fast: false matrix: - builder: [ghcr.io/nyamisty/altserver_builder_alpine_armv7, ghcr.io/nyamisty/altserver_builder_alpine_aarch64, ghcr.io/nyamisty/altserver_builder_alpine_amd64, ghcr.io/nyamisty/altserver_builder_alpine_i386] - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - submodules: recursive - - name: Do Submodule Update - if: ${{ needs.check.outputs.updated == '1' }} - run: - git submodule update --remote -- upstream_repo - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Prepare build - run: mkdir /tmp/build_output - - name: Build - run: | - image=${{ matrix.builder }} - docker pull $image - docker run -v ${PWD}:/workdir -w /workdir $image bash -c 'mkdir build; cd build; make -f ../Makefile -j3' - cp build/AltServer-* /tmp/build_output; chmod +x /tmp/build_output/* - sudo rm -rf build - git clean -fdX - - name: Upload to github artifact - uses: NyaMisty/upload-artifact-as-is@master - with: - path: /tmp/build_output + language: ["cpp"] - release: - runs-on: ubuntu-latest - if: ${{ startsWith(github.ref, 'refs/tags/') }} - needs: [build] - name: "release" - steps: - - name: "Create artifact directory" - run: | - mkdir -p build_output - - name: "Download all artifacts" - uses: actions/download-artifact@v2 - with: - path: build_output - - name: "Rearrange artifacts" - run: | - find build_output - mkdir -p build_release - mv build_output/*/* build_release - ls build_release - if [ "$(ls -A build_release)" ]; then exit 0; else exit 1; fi - - name: Release - uses: softprops/action-gh-release@v1 - with: - files: build_release/* - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - update_submodule: - runs-on: ubuntu-latest - needs: [check, build] - if: ${{ needs.check.outputs.updated == '1' }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: - fetch-depth: 0 submodules: recursive - - name: Commit Submodule Update - run: | - git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - git submodule update --remote -- upstream_repo - git commit -m "[server] Sync Upstream Repo commit" upstream_repo - - name: Push changes - uses: ad-m/github-push-action@master + + - name: Install build dependencies + run: "paru --noconfirm -Syu base-devel cmake clang ninja git make boost zlib python3 avahi && aur-install libcorecrypto-git" + + - name: Compile + run: > + mkdir build && cd build + && cmake -GNinja -DBUILD_SHARED_LIBS=OFF .. && cmake --build . --config Release -- -j 8 + + - name: Upload Artifact + uses: actions/upload-artifact@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }} - \ No newline at end of file + name: build + path: | + build/ + !build/cmake + !build/_deps \ No newline at end of file diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml deleted file mode 100644 index befdc6a..0000000 --- a/.github/workflows/build_docker.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Build buildenv Docker - -on: - workflow_dispatch: - -env: - REGISTRY: ghcr.io - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - ref: master # set the branch to merge to - fetch-depth: 0 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - #- - # uses: docker/setup-buildx-action@v1 - # id: buildx - # with: - # install: true - - - name: Available platforms - run: echo ${{ steps.buildx.outputs.platforms }} - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build & Push Dockers - run: cd ./buildenv && bash ./build_docker.sh - diff --git a/.gitignore b/.gitignore index 9d1f8dd..f6abb76 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /build *.o -.vscode \ No newline at end of file +.cache +.vscode +upstream_patched \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index e87767b..8d8ae94 100644 --- a/.gitmodules +++ b/.gitmodules @@ -12,9 +12,6 @@ [submodule "libraries/libimobiledevice"] path = libraries/libimobiledevice url = https://github.com/libimobiledevice/libimobiledevice -[submodule "libraries/ideviceinstaller"] - path = libraries/ideviceinstaller - url = https://github.com/libimobiledevice/ideviceinstaller [submodule "libraries/libimobiledevice-glue"] path = libraries/libimobiledevice-glue url = https://github.com/libimobiledevice/libimobiledevice-glue diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..7ae89d3 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,68 @@ +cmake_minimum_required(VERSION 3.12) +project(altserver-linux VERSION 0.0.5) + +set(ALTSERVER_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + +# ------------------------------------------------------------------------------------------------------------------------------- +# Options +# ------------------------------------------------------------------------------------------------------------------------------- + +option(altserver_cli "Whether or not to build the cli" ON) + +# ------------------------------------------------------------------------------------------------------------------------------- +# Patch upstream project +# ------------------------------------------------------------------------------------------------------------------------------- + +include(cmake/patch.cmake) + +patch_prepare() + +patch(altserver PATTERN "AltServer/*.[ch]*" EXCLUDE_PATTERN "AltServer/AltServer.cpp" "AltServer/WiredConnection.cpp" "AltServer/AnisetteDataManager.cpp") +patch(altsign PATTERN "AltSign/*.[ch]*") +patch(ldid PATTERN "ldid/*.[ch]*") + +# ------------------------------------------------------------------------------------------------------------------------------- +# Compile options +# ------------------------------------------------------------------------------------------------------------------------------- + +add_definitions(-w) # Ouch, we need this because cpprestsdk might cause fat errors otherwise. + +# ------------------------------------------------------------------------------------------------------------------------------- +# Force Include some shims +# ------------------------------------------------------------------------------------------------------------------------------- + +# This is really bad +add_definitions(-include "${ALTSERVER_DIR}/src/common.h" -include "${ALTSERVER_DIR}/shims/windows_shim.h") + +# ------------------------------------------------------------------------------------------------------------------------------- +# Setup Dependencies +# ------------------------------------------------------------------------------------------------------------------------------- + +# This is also pretty bad practice imo, but exporting all of the defines into cmake would also be retarded +add_definitions(-include "${ALTSERVER_DIR}/config/libimobiledevice.h" -include "${ALTSERVER_DIR}/config/dnssd.h") + +add_subdirectory(cmake/ldid) +add_subdirectory(cmake/minizip) +add_subdirectory(cmake/libplist) +add_subdirectory(cmake/CoreCrypto) +add_subdirectory(libraries/dnssd_loader) +add_subdirectory(cmake/libimobiledevice) +add_subdirectory(cmake/libimobiledevice-glue) + +add_subdirectory(cmake/AltSign) +add_subdirectory(cmake/AltServer) + +# ------------------------------------------------------------------------------------------------------------------------------- +# Setup Executable +# ------------------------------------------------------------------------------------------------------------------------------- + +if (altserver_cli) + file(GLOB src "src/*.cpp") + add_executable(${PROJECT_NAME} ${src}) + + target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17) + set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17 CXX_EXTENSIONS OFF CXX_STANDARD_REQUIRED ON) + + add_subdirectory(cmake/libusbmuxd) + target_link_libraries(${PROJECT_NAME} PUBLIC usbmuxd uuid altserver altsign ${Boost_LIBRARIES} ) +endif() diff --git a/Makefile b/Makefile deleted file mode 100644 index 0d3ce07..0000000 --- a/Makefile +++ /dev/null @@ -1,130 +0,0 @@ -PROGRAM := AltServer - -ARCH := $(shell gcc -dumpmachine | cut -d- -f 1) - -PROGRAM := $(PROGRAM)-$(ARCH) - -CFLAGS := -DDEBUG -O0 -g - -ifeq ($(ARCH),i386) -CFLAGS += -mno-default -endif - -ifeq ($(ARCH),i686) -CFLAGS += -mno-default -endif - -CXXFLAGS = $(CFLAGS) -std=c++17 - -CFLAGS += -DNO_USBMUXD_STUB - -ROOT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) -include $(ROOT_DIR)/makefiles/main.mak - -$(BUILD_DIR)/libimobiledevice.a $(BUILD_DIR)/libplist.a : - $(MAKE) -f $(ROOT_DIR)/makefiles/libimobiledevice-build/libimobiledevice.mak -lib_libimobiledevice: $(BUILD_DIR)/libimobiledevice.a $(BUILD_DIR)/libplist.a -lib_libimobiledevice_clean : - $(MAKE) -f $(ROOT_DIR)/makefiles/libimobiledevice-build/libimobiledevice.mak clean -.PHONY: $(BUILD_DIR)/libimobiledevice.a $(BUILD_DIR)/libplist.a lib_libimobiledevice lib_libimobiledevice_clean - -$(BUILD_DIR)/AltSign.a: - $(MAKE) -f $(ROOT_DIR)/makefiles/AltSign-build/AltSign.mak EXTRA_FLAGS=$(libplist_include) -lib_AltSign : $(BUILD_DIR)/AltSign.a $(BUILD_DIR)/libplist.a -lib_AltSign_clean : - $(MAKE) -f $(ROOT_DIR)/makefiles/AltSign-build/AltSign.mak clean -.PHONY: $(BUILD_DIR)/AltSign.a $(BUILD_DIR)/libplist.a lib_AltSign lib_AltSign_clean - -$(BUILD_DIR)/dnssd_loader.a: - $(MAKE) -f $(ROOT_DIR)/makefiles/dnssd_loader-build/dnssd_loader.mak -lib_dnssd_loader : $(BUILD_DIR)/dnssd_loader.a -lib_dnssd_loader_clean : - $(MAKE) -f $(ROOT_DIR)/makefiles/dnssd_loader-build/dnssd_loader.mak clean -.PHONY: $(BUILD_DIR)/dnssd_loader.a lib_dnssd_loader lib_dnssd_loader_clean - - -include $(ROOT_DIR)/makefiles/libimobiledevice-build/libimobiledevice-files.mak -include $(ROOT_DIR)/makefiles/AltSign-build/AltSign-files.mak -include $(ROOT_DIR)/makefiles/dnssd_loader-build/dnssd_loader-files.mak - -#libimobiledevice_include := -I$(LIB_DIR)/libimobiledevice/include -I$(LIB_DIR)/libimobiledevice -I$(LIB_DIR)/libusbmuxd/include -#libplist_include := -I$(LIB_DIR)/libplist/include -#altsign_include := -I$(BUILD_DIR)/AltSign_patched - -#INC_CFLAGS := -Ilibraries -INC_CFLAGS += $(libimobiledevice_include) -INC_CFLAGS += $(libplist_include) -INC_CFLAGS += $(altsign_include) -INC_CFLAGS += $(dnssd_loader_include) - -include $(ROOT_DIR)/makefiles/AltWindowsShim.mak - -main_srcroot := $(UPSTREAM_DIR)/AltServer -main_override_srcroot := $(ROOT_DIR)/src -main_override_src := $(wildcard $(main_override_srcroot)/*.cpp) - -main_orisrc := $(wildcard $(main_srcroot)/*.cpp) $(wildcard $(main_srcroot)/*.c) - -main_orisrc := $(filter-out $(main_srcroot)/AltServer.cpp, $(main_orisrc)) -main_orisrc := $(filter-out $(main_override_src:$(main_override_srcroot)/%=$(main_srcroot)/%), $(main_orisrc)) -#main_orisrc := $(filter-out $(main_srcroot)/AltServerApp.cpp, $(main_orisrc)) -#main_orisrc := $(filter-out $(main_srcroot)/AnisetteDataManager.cpp, $(main_orisrc)) - -#$(BUILD_DIR)/objs/%.c.o : $(BUILD_DIR)/%.c -# python3 $(ROOT_DIR)/makefiles/AltSign-build/rewrite_altserver_source.py "$<" | $(CC) -x c -I`dirname $<` $(CFLAGS) $(EXTRA_FLAGS) -o $@ -c - -# #$(CC) $(CFLAGS) $(EXTRA_FLAGS) -o $@ -c $< -# -#$(BUILD_DIR)/objs/%.cpp.o : $(BUILD_DIR)/%.cpp -# python3 $(ROOT_DIR)/makefiles/AltSign-build/rewrite_altserver_source.py "$<" | $(CXX) -x c++ -I`dirname $<` $(CXXFLAGS) $(EXTRA_FLAGS) -o $@ -c - -# #$(CXX) $(CXXFLAGS) $(EXTRA_FLAGS) -o $@ -c $< - -main_patched_root := $(BUILD_DIR)/AltServer_patched -main_orifiles := $(wildcard $(main_srcroot)/*.*) -main_newfiles := $(main_orifiles:$(main_srcroot)/%=$(main_patched_root)/%) - -$(main_patched_root)/%: $(main_srcroot)/% - mkdir -p `dirname "$@"` - python3 $(ROOT_DIR)/makefiles/rewrite_altserver_source.py "$<" > $@ - -$(main_newfiles) : $(main_orifiles) - -preprocess : $(main_newfiles) -.PHONY : preprocess - - -$(BUILD_DIR)/objs/%.c.o : $(BUILD_DIR)/%.c - mkdir -p $(@D) - $(CC) $(CFLAGS) $(EXTRA_FLAGS) -o $@ -c $< - -$(BUILD_DIR)/objs/%.cpp.o : $(BUILD_DIR)/%.cpp - mkdir -p $(@D) - $(CXX) $(CXXFLAGS) $(EXTRA_FLAGS) -o $@ -c $< - -$(BUILD_DIR)/objs/%.c.o : $(ROOT_DIR)/%.c - mkdir -p $(@D) - $(CC) $(CFLAGS) $(EXTRA_FLAGS) -o $@ -c $< - -$(BUILD_DIR)/objs/%.cpp.o : $(ROOT_DIR)/%.cpp - mkdir -p $(@D) - $(CXX) $(CXXFLAGS) $(EXTRA_FLAGS) -o $@ -c $< - -main_newsrc := $(main_orisrc:$(main_srcroot)/%=$(main_patched_root)/%) -#main_objs = $(main_orisrc:$(UPSTREAM_DIR)/%=$(BUILD_DIR)/objs/%.o) - -main_objs = $(main_newsrc:$(BUILD_DIR)/%=$(BUILD_DIR)/objs/%.o) $(main_override_src:$(ROOT_DIR)/%=$(BUILD_DIR)/objs/%.o) $(shim_src:$(MAIN_DIR)/%=$(BUILD_DIR)/objs/%.o) - -$(main_objs) : lib_AltSign lib_libimobiledevice lib_dnssd_loader - -$(main_objs) : EXTRA_FLAGS := -I$(main_patched_root) -I$(ROOT_DIR)/src -fpermissive -include "common.h" $(INC_CFLAGS) - -LDFLAGS = -static -lssl -lcrypto -lpthread -lcorecrypto_static -lzip -lm -lz -lcpprest -lboost_system -lboost_filesystem -lstdc++ -lssl -lcrypto -luuid - -$(BUILD_DIR)/$(PROGRAM):: $(main_objs) $(BUILD_DIR)/libimobiledevice.a $(BUILD_DIR)/AltSign.a $(BUILD_DIR)/libplist.a $(BUILD_DIR)/dnssd_loader.a - $(CC) -o $@ $^ $(LDFLAGS) - -.PHONY: clean all -clean:: lib_libimobiledevice_clean lib_AltSign_clean lib_dnssd_loader_clean - rm -f $(main_objs) $(BUILD_DIR)/$(PROGRAM) - -all:: preprocess $(BUILD_DIR)/$(PROGRAM) -.DEFAULT_GOAL := all diff --git a/README.md b/README.md index 345d77c..ca8c701 100644 --- a/README.md +++ b/README.md @@ -1,73 +1,76 @@ # AltServer-Linux + AltServer for AltStore, but on-device ## Usage -- Install IPA: `./AltServer -u [UDID] -a [AppleID account] -p [AppleID password] [ipaPath.ipa]` -- Running as AltServer Daemon: `./AltServer` -- Full usage (maybe outdated, refer to `./AltServer -h` for the newest): -``` -Usage: AltServer-Linux options [ ipa-file ] - -h --help Display this usage information. - -u --udid UDID Device's UDID, only needed when installing IPA. - -a --appleID AppleID Apple ID to sign the ipa, only needed when installing IPA. - -p --password passwd Password of Apple ID, only needed when installing IPA. - -d --debug Print debug output, can be used several times to increase debug level. - -The following environment var can be set for some special situation: - - ALTSERVER_ANISETTE_SERVER: Set to custom anisette server URL - if not set, the default one: https://armconverter.com/anisette/irGb3Quww8zrhgqnzmrx, is used - - ALTSERVER_NO_SUBSCRIBE: (*unused*) Please enable this for usbmuxd server that do not correctly usbmuxd_listen interfaces -``` +- ๐Ÿ“ฆ Install IPA + ```bash + ./AltServer -u [UDID] -a [AppleID account] -p [AppleID password] [ipaPath.ipa] + ``` + +- โžฐ Running as AltServer Daemon + ```bash + ./AltServer + ``` + +- ๐Ÿงช Full Usage + ```bash + Usage: AltServer-Linux options [ ipa-file ] + -h --help Display this usage information. + -u --udid UDID Device's UDID, only needed when installing IPA. + -a --appleID AppleID Apple ID to sign the ipa, only needed when installing IPA. + -p --password passwd Password of Apple ID, only needed when installing IPA. + -d --debug Print debug output, can be used several times to increase debug level. + + The following environment var can be set for some special situation: + - ALTSERVER_ANISETTE_SERVER: Set to custom anisette server URL + if not set, the default one: https://armconverter.com/anisette/irGb3Quww8zrhgqnzmrx, is used + - ALTSERVER_NO_SUBSCRIBE: (*unused*) Please enable this for usbmuxd server that do not correctly usbmuxd_listen interfaces + ``` ## Download -- Precompiled static binary can be downloaded in Release ( also have a look at pre-release ;) ) -- Nightly version is available as Github Actions artifacts +- [Github Release](https://github.com/NyaMisty/AltServer-Linux/releases) +- [altserver-linux-curve-git AUR](https://aur.archlinux.org/packages/altserver-linux-curve-git) +- Nightly Builds are available as [Workflow Artifacts](https://github.com/NyaMisty/AltServer-Linux/actions) -## TODO / Special Features -- [x] Track upstream (AltServer-Windows) develop branch (i.e. Beta version) -- [x] Support Offline Anisette Data Generation (i.e. without Sideloadly) - - Finsihed, please run [alt_anisette_server](https://hub.docker.com/r/nyamisty/alt_anisette_server) & use `ALTSERVER_ANISETTE_SERVER` to specify custom server URL -- [x] Support Wi-Fi Refresh - - [netmuxd](https://github.com/jkcoxson/netmuxd) now supports network devices (needs version > v0.1.1, be sure to check pre-release) - - Download `netmuxd`, stop the original `usbmuxd`, and run `netmuxd` before running `AltServer-Linux` - - ~If netmuxd does not work, please try using special env var `ALTSERVER_NO_SUBSCRIBE`. Enabling this would disable **auto-refresh when plugged-in** of USB devices~ +--- ----- +# Offline Anisette -## Advanced: Build Instruction (check Github Actions if you cannot build) +Offline Anisette Data Generation (i.e. with Sideloadly) is supported. +Run [alt_anisette_server](https://hub.docker.com/r/nyamisty/alt_anisette_server) and specify the custom server url through the environment variable `ALTSERVER_ANISETTE_SERVER`. -- Preparation: `git clone --recursive https://github.com/NyaMisty/AltServer-Linux` +# Wi-Fi Refresh -- Install dependencies (see notes below): corecrypto_static, cpprestsdk static lib, boost static lib +[netmuxd](https://github.com/jkcoxson/netmuxd) supports network devices since versions `>0.1.1`. -- Build: - ``` - cd AltServer-Linux - mkdir build - make -f ../Makefile -j3 - ls AltServer-* - ``` +To use netmuxd stop the original `usbmuxd` and run `netmuxd` before starting altserver. -- My own build note for you - ``` - 1. Run alpine docker (change --platform to corresponding architecture you want): - docker run --platform=linux/arm/v7 --name altserver-builder-alpine-armv7 -it alpine:3.15 - 2. Install dependencies: - apk add zsh git curl wget g++ clang boost-static ninja boost-dev cmake make sudo bash vim libressl-dev util-linux-dev zlib-dev zlib-static - 3. Install corecrypto - download corecrypto from apple website, unzip corecrypto.zip; cd corecrypto; mkdir build; cd build; CC=clang CXX=clang++ cmake ..; - vim CMakeFiles/Makefile2, delete line starts with "all: corecrypto_perf/....." and "all: corecrypto_test/.....", then make; make install - 4. Install cpprestsdk - git clone --recursive https://github.com/microsoft/cpprestsdk; cd cpprestsdk; mkdir build; cmake -DBUILD_SHARED_LIBS=0 ..; make; make install - (if you're compiling for armv7, you have to grep -Wcast-align, and remove it, or the compiling would fail) - 5. Install libzip - git clone https://github.com/nih-at/libzip; cd libzip; mkdir build; cd build; cmake -DBUILD_SHARED_LIBS=0 ..; make; make install - 6. Compile AltServer-Linux - git clone --recursive https://github.com/NyaMisty/AltServer-Linux - cd AltServer-Linux - make -f ../Makefile -j3 - (if you're compiling for ARM, i.e. armv7 or aarch64, you'll have to remove the -mno-default flag in Makefile) +> ~~If netmuxd does not work, please try using special env var `ALTSERVER_NO_SUBSCRIBE`. Enabling this would disable **auto-refresh when plugged-in** of USB devices~~ + +--- + +## Advanced: Build Instructions +> If you have issues with building you may want to checkout the build workflow +> **Note** +> The following build instructions apply to archlinux only, but should be roughly the same on other distros. + +- ๐Ÿšง Install Build Dependencies + ```bash + yay -S boost clang cmake ninja git libcorecrypto-git zlib python3 avahi ``` + +- ๐Ÿ“ฆ Grab the source + ```bash + git clone --recursive https://github.com/NyaMisty/AltServer-Linux + cd AltServer-Linux + ```` + +- ๐Ÿ—๏ธ Build + ```bash + mkdir build && cd build + cmake .. && cmake --build . --config Release + ``` \ No newline at end of file diff --git a/buildenv/Dockerfile b/buildenv/Dockerfile deleted file mode 100644 index 20c0458..0000000 --- a/buildenv/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -ARG IMAGE=arm64v8/alpine:3.15 - -FROM $IMAGE - -RUN apk add zsh git curl wget g++ clang boost-static ninja boost-dev cmake make sudo bash vim libressl-dev util-linux-dev zlib-dev zlib-static - -RUN mkdir /buildenv - -WORKDIR /buildenv - -RUN curl -JO 'https://developer.apple.com/file/?file=security&agree=Yes' -H 'Referer: https://developer.apple.com/security/' && unzip corecrypto.zip -WORKDIR /buildenv/corecrypto -RUN mkdir build; cd build; CC=clang CXX=clang++ cmake ..; -WORKDIR /buildenv/corecrypto/build -RUN sed -i -E 's|^(all: CMakeFiles\/corecrypto_perf)|#\1|' CMakeFiles/Makefile2; sed -i -E 's|^(all: CMakeFiles\/corecrypto_test)|#\1|' CMakeFiles/Makefile2 -RUN make -j6; make install - -WORKDIR /buildenv - -RUN git clone --recursive https://github.com/microsoft/cpprestsdk; -WORKDIR /buildenv/cpprestsdk -RUN sed -i 's|-Wcast-align||' "./Release/CMakeLists.txt" -RUN mkdir build; cd build; cmake -DBUILD_SHARED_LIBS=0 ..; make -j6; make install - -WORKDIR /buildenv/ - -RUN git clone https://github.com/nih-at/libzip && cd libzip; mkdir build; cd build; cmake -DBUILD_SHARED_LIBS=0 ..; make -j6; make install - - diff --git a/buildenv/build_docker.sh b/buildenv/build_docker.sh deleted file mode 100644 index d2d8d36..0000000 --- a/buildenv/build_docker.sh +++ /dev/null @@ -1,11 +0,0 @@ -docker build --build-arg IMAGE=arm32v7/alpine:3.15 -t ghcr.io/nyamisty/altserver_builder_alpine_armv7 . -docker push ghcr.io/nyamisty/altserver_builder_alpine_armv7 - -docker build --build-arg IMAGE=arm64v8/alpine:3.15 -t ghcr.io/nyamisty/altserver_builder_alpine_aarch64 . -docker push ghcr.io/nyamisty/altserver_builder_alpine_aarch64 - -docker build --build-arg IMAGE=amd64/alpine:3.15 -t ghcr.io/nyamisty/altserver_builder_alpine_amd64 . -docker push ghcr.io/nyamisty/altserver_builder_alpine_amd64 - -docker build --build-arg IMAGE=i386/alpine:3.15 -t ghcr.io/nyamisty/altserver_builder_alpine_i386 . -docker push ghcr.io/nyamisty/altserver_builder_alpine_i386 diff --git a/cmake/AltServer/CMakeLists.txt b/cmake/AltServer/CMakeLists.txt new file mode 100644 index 0000000..3048637 --- /dev/null +++ b/cmake/AltServer/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.1) +project(altserver LANGUAGES CXX) + +# ------------------------------------------------------------------------------------------------------------------------------- +# Setup library +# ------------------------------------------------------------------------------------------------------------------------------- + +file(GLOB src "${ALTSERVER_DIR}/upstream_patched/AltServer/*.c*") + +add_library(${PROJECT_NAME} STATIC ${c_src} ${src}) +add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) + +target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17 CXX_EXTENSIONS OFF CXX_STANDARD_REQUIRED ON) + +# -------------------------------------------------------------------------------------------------------- +# Use shims +# -------------------------------------------------------------------------------------------------------- + +file(GLOB shims "${ALTSERVER_DIR}/shims/*.c*") +target_sources(${PROJECT_NAME} PRIVATE ${shims}) + +# -------------------------------------------------------------------------------------------------------- +# Include directories +# -------------------------------------------------------------------------------------------------------- + +target_include_directories(${PROJECT_NAME} PRIVATE "${ALTSERVER_DIR}/shims") +target_include_directories(${PROJECT_NAME} PUBLIC "${ALTSERVER_DIR}/upstream_patched/AltServer") + +# -------------------------------------------------------------------------------------------------------- +# Link required libraries +# -------------------------------------------------------------------------------------------------------- + +target_link_libraries(${PROJECT_NAME} PUBLIC imobiledevice::imobiledevice dnssd::dnssd altsign::altsign) \ No newline at end of file diff --git a/cmake/AltSign/CMakeLists.txt b/cmake/AltSign/CMakeLists.txt new file mode 100644 index 0000000..02f569d --- /dev/null +++ b/cmake/AltSign/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.1) +project(altsign LANGUAGES CXX) + +# ------------------------------------------------------------------------------------------------------------------------------- +# Setup library +# ------------------------------------------------------------------------------------------------------------------------------- + +file(GLOB src "${ALTSERVER_DIR}/upstream_patched/AltSign/*.c*") + +add_library(${PROJECT_NAME} STATIC ${c_src} ${src}) +add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) + +target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17 CXX_EXTENSIONS OFF CXX_STANDARD_REQUIRED ON) + +# -------------------------------------------------------------------------------------------------------- +# Include directories +# -------------------------------------------------------------------------------------------------------- + +target_include_directories(${PROJECT_NAME} PUBLIC "${ALTSERVER_DIR}/shims") +target_include_directories(${PROJECT_NAME} PUBLIC "${ALTSERVER_DIR}/upstream_patched/AltSign") + +# -------------------------------------------------------------------------------------------------------- +# Link required libraries +# -------------------------------------------------------------------------------------------------------- + +find_package(Boost REQUIRED) +target_link_libraries(${PROJECT_NAME} PUBLIC ${Boost_LIBRARIES}) +target_include_directories(${PROJECT_NAME} PRIVATE ${Boost_INCLUDE_DIRS}) + +include(FetchContent) + +FetchContent_Declare(cpprestsdk GIT_REPOSITORY "https://github.com/microsoft/cpprestsdk" GIT_TAG "2.10.18") +FetchContent_MakeAvailable(cpprestsdk) + +target_link_libraries(${PROJECT_NAME} PUBLIC plist::plist ldid::ldid minizip::minizip corecrypto::corecrypto cpprest) \ No newline at end of file diff --git a/cmake/CoreCrypto/CMakeLists.txt b/cmake/CoreCrypto/CMakeLists.txt new file mode 100644 index 0000000..670d803 --- /dev/null +++ b/cmake/CoreCrypto/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.1) +project(corecrypto LANGUAGES C) + +# ------------------------------------------------------------------------------------------------------------------------------- +# Setup library +# ------------------------------------------------------------------------------------------------------------------------------- + +add_library(${PROJECT_NAME} INTERFACE) +add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) + +# -------------------------------------------------------------------------------------------------------- +# Include directories +# -------------------------------------------------------------------------------------------------------- + +target_include_directories(${PROJECT_NAME} INTERFACE "${ALTSERVER_DIR}/upstream_patched/AltSign/Dependencies/") + +# -------------------------------------------------------------------------------------------------------- +# Link required libraries +# -------------------------------------------------------------------------------------------------------- + +target_link_libraries(${PROJECT_NAME} INTERFACE corecrypto_static) \ No newline at end of file diff --git a/cmake/ldid/CMakeLists.txt b/cmake/ldid/CMakeLists.txt new file mode 100644 index 0000000..900c1da --- /dev/null +++ b/cmake/ldid/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.1) +project(ldid) + +# ------------------------------------------------------------------------------------------------------------------------------- +# Setup library +# ------------------------------------------------------------------------------------------------------------------------------- + +file(GLOB c_src "${ALTSERVER_DIR}/upstream_patched/ldid/*.c") +set_source_files_properties(${c_src} PROPERTIES LANGUAGE C) + +file(GLOB src "${ALTSERVER_DIR}/upstream_patched/ldid/*.cpp") +set_source_files_properties(${src} PROPERTIES LANGUAGE CXX) + +add_library(${PROJECT_NAME} STATIC ${c_src} ${src}) +add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) + +target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17 CXX_EXTENSIONS OFF CXX_STANDARD_REQUIRED ON) + +# -------------------------------------------------------------------------------------------------------- +# Include directories +# -------------------------------------------------------------------------------------------------------- + +target_include_directories(${PROJECT_NAME} PRIVATE "${ALTSERVER_DIR}/shims") +target_include_directories(${PROJECT_NAME} PUBLIC "${ALTSERVER_DIR}/upstream_patched/ldid") + +# -------------------------------------------------------------------------------------------------------- +# Link required libraries +# -------------------------------------------------------------------------------------------------------- + +target_link_libraries(${PROJECT_NAME} PUBLIC plist::plist) \ No newline at end of file diff --git a/cmake/libimobiledevice-glue/CMakeLists.txt b/cmake/libimobiledevice-glue/CMakeLists.txt new file mode 100644 index 0000000..5eed9ad --- /dev/null +++ b/cmake/libimobiledevice-glue/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.1) +project(imobiledevice-glue LANGUAGES C) + +# ------------------------------------------------------------------------------------------------------------------------------- +# Setup library +# ------------------------------------------------------------------------------------------------------------------------------- + +set(ROOT "${ALTSERVER_DIR}/libraries/libimobiledevice-glue") +file(GLOB src "${ROOT}/src/*.c" "${ROOT}/common/*.c") + +add_library(${PROJECT_NAME} STATIC ${src}) +add_library(imobiledevice::glue ALIAS ${PROJECT_NAME}) + +# -------------------------------------------------------------------------------------------------------- +# Include directories +# -------------------------------------------------------------------------------------------------------- + +target_include_directories(${PROJECT_NAME} PRIVATE "${ROOT}") +target_include_directories(${PROJECT_NAME} PUBLIC "${ROOT}/include") + +# -------------------------------------------------------------------------------------------------------- +# Link required libraries +# -------------------------------------------------------------------------------------------------------- + +target_link_libraries(${PROJECT_NAME} PUBLIC plist::plist) \ No newline at end of file diff --git a/cmake/libimobiledevice/CMakeLists.txt b/cmake/libimobiledevice/CMakeLists.txt new file mode 100644 index 0000000..9f48dac --- /dev/null +++ b/cmake/libimobiledevice/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.1) +project(imobiledevice LANGUAGES C) + +# ------------------------------------------------------------------------------------------------------------------------------- +# Setup library +# ------------------------------------------------------------------------------------------------------------------------------- + +set(ROOT "${ALTSERVER_DIR}/libraries/libimobiledevice") +file(GLOB src "${ROOT}/src/*.c" "${ROOT}/common/*.c") + +add_library(${PROJECT_NAME} STATIC ${src}) +add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) + +# -------------------------------------------------------------------------------------------------------- +# Include directories +# -------------------------------------------------------------------------------------------------------- + +target_include_directories(${PROJECT_NAME} PUBLIC "${ROOT}") +target_include_directories(${PROJECT_NAME} PUBLIC "${ALTSERVER_DIR}/libraries") +target_include_directories(${PROJECT_NAME} PUBLIC "${ROOT}/include" "${ROOT}/common") + +# -------------------------------------------------------------------------------------------------------- +# Link required libraries +# -------------------------------------------------------------------------------------------------------- + +find_package(OpenSSL REQUIRED) +target_link_libraries(${PROJECT_NAME} PUBLIC imobiledevice::glue usbmuxd::usbmuxd OpenSSL::SSL) \ No newline at end of file diff --git a/cmake/libplist/CMakeLists.txt b/cmake/libplist/CMakeLists.txt new file mode 100644 index 0000000..a3c63ee --- /dev/null +++ b/cmake/libplist/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.1) +project(plist) + +# ------------------------------------------------------------------------------------------------------------------------------- +# Setup library +# ------------------------------------------------------------------------------------------------------------------------------- + +set(ROOT "${ALTSERVER_DIR}/libraries/libplist") + +file(GLOB c_src "${ROOT}/src/*.c" "${ROOT}/libcnary/*.c") +list(FILTER c_src EXCLUDE REGEX "cnary\.c") +set_source_files_properties(${c_src} PROPERTIES LANGUAGE C) + +file(GLOB src "${ROOT}/src/*.cpp" "${ROOT}/libcnary/*.cpp") +set_source_files_properties(${src} PROPERTIES LANGUAGE CXX) + +add_library(${PROJECT_NAME} STATIC ${c_src} ${src}) +add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) + +# -------------------------------------------------------------------------------------------------------- +# Include directories +# -------------------------------------------------------------------------------------------------------- + +target_include_directories(${PROJECT_NAME} PRIVATE "${ROOT}/src") +target_include_directories(${PROJECT_NAME} PUBLIC "${ROOT}/include") +target_include_directories(${PROJECT_NAME} PUBLIC "${ROOT}/libcnary/include") \ No newline at end of file diff --git a/cmake/libusbmuxd/CMakeLists.txt b/cmake/libusbmuxd/CMakeLists.txt new file mode 100644 index 0000000..57e1cbf --- /dev/null +++ b/cmake/libusbmuxd/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.1) +project(usbmuxd LANGUAGES C) + +# ------------------------------------------------------------------------------------------------------------------------------- +# Setup library +# ------------------------------------------------------------------------------------------------------------------------------- + +set(ROOT "${ALTSERVER_DIR}/libraries/libusbmuxd") + +file(GLOB src "${ROOT}/src/*.c") +add_library(${PROJECT_NAME} STATIC ${src}) +add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) + +# -------------------------------------------------------------------------------------------------------- +# Include directories +# -------------------------------------------------------------------------------------------------------- + +target_include_directories(${PROJECT_NAME} PUBLIC "${ROOT}/include") + +# -------------------------------------------------------------------------------------------------------- +# Link required libraries +# -------------------------------------------------------------------------------------------------------- + +target_link_libraries(${PROJECT_NAME} PUBLIC imobiledevice::imobiledevice) \ No newline at end of file diff --git a/cmake/minizip/CMakeLists.txt b/cmake/minizip/CMakeLists.txt new file mode 100644 index 0000000..982aff6 --- /dev/null +++ b/cmake/minizip/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.1) +project(minizip LANGUAGES C) + +# ------------------------------------------------------------------------------------------------------------------------------- +# Setup library +# ------------------------------------------------------------------------------------------------------------------------------- + +file(GLOB src "${ALTSERVER_DIR}/upstream_patched/AltSign/Dependencies/minizip/*.c") +list(FILTER src EXCLUDE REGEX "win|miniunz|minizip\.c") + + +add_library(${PROJECT_NAME} STATIC ${src}) +add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) + +# -------------------------------------------------------------------------------------------------------- +# Include directories +# -------------------------------------------------------------------------------------------------------- + +target_include_directories(${PROJECT_NAME} PUBLIC "${ALTSERVER_DIR}/upstream_patched/AltSign/Dependencies/minizip") + +# -------------------------------------------------------------------------------------------------------- +# Link required libraries +# -------------------------------------------------------------------------------------------------------- + +find_package(ZLIB REQUIRED) +target_link_libraries(${PROJECT_NAME} PUBLIC ZLIB::ZLIB) \ No newline at end of file diff --git a/cmake/patch.cmake b/cmake/patch.cmake new file mode 100644 index 0000000..e33f092 --- /dev/null +++ b/cmake/patch.cmake @@ -0,0 +1,35 @@ +macro(patch_prepare) + file(COPY "${ALTSERVER_DIR}/upstream_repo/" DESTINATION "${ALTSERVER_DIR}/upstream_patched/") +endmacro() + +macro(patch) + set(argn_list "${ARGN}") + list(POP_FRONT argn_list PATCH) + + cmake_parse_arguments("ARG" "" "PATCH;PATTERN" "EXCLUDE_PATTERN" ${ARGN}) + + file(GLOB to_patch "${ALTSERVER_DIR}/upstream_repo/${ARG_PATTERN}") + + foreach(file ${to_patch}) + execute_process( + COMMAND python3 "${ALTSERVER_DIR}/patches/${PATCH}.py" "${file}" + WORKING_DIRECTORY "${ALTSERVER_DIR}" + OUTPUT_VARIABLE patched + ) + + string(REPLACE "upstream_repo" "upstream_patched" patched_file "${file}") + file(WRITE "${patched_file}" "${patched}") + + message(STATUS "[altserver] Patched: ${file}") + endforeach() + + file(GLOB to_remove "${ALTSERVER_DIR}/upstream_patched/${ARG_EXCLUDE_PATTERN}") + + foreach(pattern ${ARG_EXCLUDE_PATTERN}) + file(GLOB to_remove "${ALTSERVER_DIR}/upstream_patched/${pattern}") + foreach(file ${to_remove}) + file(REMOVE "${file}") + message(STATUS "[altserver] Removed: ${file}") + endforeach() + endforeach() +endmacro() \ No newline at end of file diff --git a/makefiles/dnssd_loader-build/config.h b/config/dnssd.h similarity index 100% rename from makefiles/dnssd_loader-build/config.h rename to config/dnssd.h diff --git a/makefiles/libimobiledevice-build/config.h b/config/libimobiledevice.h similarity index 99% rename from makefiles/libimobiledevice-build/config.h rename to config/libimobiledevice.h index 1e7828c..9a7e277 100644 --- a/makefiles/libimobiledevice-build/config.h +++ b/config/libimobiledevice.h @@ -78,8 +78,6 @@ /* Define to 1 if you have the `strndup' function. */ #define HAVE_STRNDUP 1 - - /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 @@ -148,7 +146,6 @@ /* Define if you have inotify support (linux only) */ #define HAVE_INOTIFY 1 - /* Define if you have program_invocation_short_name */ #define HAVE_PROGRAM_INVOCATION_SHORT_NAME 1 @@ -174,10 +171,8 @@ to 0 otherwise. */ #define HAVE_MALLOC 1 - - /* Name of package */ -//#define PACKAGE "AltServer-Linux" +// #define PACKAGE "AltServer-Linux" /* Define to the full name of this package. */ #define PACKAGE_NAME "AltServer-Linux" diff --git a/libraries/dnssd_loader/CMakeLists.txt b/libraries/dnssd_loader/CMakeLists.txt new file mode 100644 index 0000000..767bd72 --- /dev/null +++ b/libraries/dnssd_loader/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.1) +project(dnssd LANGUAGES CXX) + +# ------------------------------------------------------------------------------------------------------------------------------- +# Setup library +# ------------------------------------------------------------------------------------------------------------------------------- + +add_library(${PROJECT_NAME} STATIC "dnssd_loader.cpp") +add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) + +target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17 CXX_EXTENSIONS OFF CXX_STANDARD_REQUIRED ON) + +# -------------------------------------------------------------------------------------------------------- +# Include directories +# -------------------------------------------------------------------------------------------------------- + +target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") \ No newline at end of file diff --git a/libraries/ideviceinstaller b/libraries/ideviceinstaller deleted file mode 160000 index 534ddef..0000000 --- a/libraries/ideviceinstaller +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 534ddefac4b7118bd4781cd91f8781d8727ff49a diff --git a/makefiles/AltSign-build/AltSign-files.mak b/makefiles/AltSign-build/AltSign-files.mak deleted file mode 100644 index 9361b8c..0000000 --- a/makefiles/AltSign-build/AltSign-files.mak +++ /dev/null @@ -1 +0,0 @@ -altsign_include := -I$(BUILD_DIR)/AltSign_patched \ No newline at end of file diff --git a/makefiles/AltSign-build/AltSign.mak b/makefiles/AltSign-build/AltSign.mak deleted file mode 100644 index 827df93..0000000 --- a/makefiles/AltSign-build/AltSign.mak +++ /dev/null @@ -1,83 +0,0 @@ -CC := clang -CXX := clang++ - -ROOT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) -include $(ROOT_DIR)/../main.mak - -ALTSIGN_ROOT := $(UPSTREAM_DIR)/AltSign -ALTSIGN_NEWROOT := $(BUILD_DIR)/AltSign_patched -MINIZIP_ROOT := $(UPSTREAM_DIR)/AltSign/Dependencies/minizip -LDID_ROOT := $(UPSTREAM_DIR)/ldid -LDID_NEWROOT := $(BUILD_DIR)/ldid_patched - -include $(MAIN_DIR)/makefiles/AltWindowsShim.mak - -CFLAGS += -I$(ALTSIGN_ROOT) -I$(MINIZIP_ROOT) -I$(LDID_ROOT) -mno-sse -#CFLAGS += -DLDID_NOTOOLS # will lose some symbol if enable this - -CXXFLAGS = $(CFLAGS) -std=c++17 - -altsign_orifiles := $(wildcard $(ALTSIGN_ROOT)/*.*) -altsign_newfiles := $(altsign_orifiles:$(ALTSIGN_ROOT)/%=$(ALTSIGN_NEWROOT)/%) - -$(ALTSIGN_NEWROOT)/%: $(ALTSIGN_ROOT)/% - mkdir -p `dirname "$@"` - python3 $(ROOT_DIR)/rewrite_altsign_source.py "$<" > $@ - -$(altsign_newfiles) : $(altsign_orifiles) -altsign_src := $(filter %.cpp,$(altsign_newfiles)) - - -ldid_orifiles := $(LDID_ROOT)/ldid.cpp $(LDID_ROOT)/lookup2.c -ldid_newfiles := $(ldid_orifiles:$(LDID_ROOT)/%=$(LDID_NEWROOT)/%) - -$(LDID_NEWROOT)/%: $(LDID_ROOT)/% - mkdir -p `dirname "$@"` - python3 $(ROOT_DIR)/rewrite_ldid_source.py "$<" > $@ - -$(ldid_newfiles) : $(ldid_orifiles) -ldid_src := $(ldid_newfiles) - - -preprocess : $(altsign_newfiles) $(ldid_newfiles) -.PHONY : preprocess - -minizip_src := $(MINIZIP_ROOT)/ioapi.c $(MINIZIP_ROOT)/zip.c $(MINIZIP_ROOT)/unzip.c - -objs += $(altsign_src:$(BUILD_DIR)/%=$(BUILD_DIR)/objs/%.o) -objs += $(ldid_src:$(BUILD_DIR)/%=$(BUILD_DIR)/objs/%.o) -objs += $(minizip_src:$(MAIN_DIR)/%=$(BUILD_DIR)/objs/%.o) - -#ldid/%.o : CC := gcc -#ldid/%.o : CXX := g++ - -$(BUILD_DIR)/objs/%.c.o : $(BUILD_DIR)/%.c - mkdir -p $(@D) - $(CC) $(CFLAGS) $(EXTRA_FLAGS) -o $@ -c $< - -$(BUILD_DIR)/objs/%.cpp.o : $(BUILD_DIR)/%.cpp - mkdir -p $(@D) - $(CXX) $(CXXFLAGS) $(EXTRA_FLAGS) -o $@ -c $< - -$(BUILD_DIR)/objs/%.c.o : $(MAIN_DIR)/%.c - mkdir -p $(@D) - $(CC) $(CFLAGS) $(EXTRA_FLAGS) -o $@ -c $< - -$(BUILD_DIR)/objs/%.cpp.o : $(MAIN_DIR)/%.cpp - mkdir -p $(@D) - $(CXX) $(CXXFLAGS) $(EXTRA_FLAGS) -o $@ -c $< - -#python3 $(ROOT_DIR)/rewrite_altsign_source.py "$<" | $(CC) -x c -I`dirname $<` $(CFLAGS) $(EXTRA_FLAGS) -o $@ -c - -#python3 $(ROOT_DIR)/rewrite_altsign_source.py "$<" | $(CXX) -x c++ -I`dirname $<` $(CXXFLAGS) $(EXTRA_FLAGS) -o $@ -c - - -$(BUILD_DIR)/AltSign.a : $(objs) - ar rcs $@ $^ - -clean:: - rm -rf $(ALTSIGN_NEWROOT) - rm -f $(objs) AltSign.a - -all :: preprocess $(BUILD_DIR)/AltSign.a -.PHONY : all - -.DEFAULT_GOAL := all diff --git a/makefiles/AltWindowsShim.mak b/makefiles/AltWindowsShim.mak deleted file mode 100644 index 21ae02a..0000000 --- a/makefiles/AltWindowsShim.mak +++ /dev/null @@ -1,8 +0,0 @@ -_ROOT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) -include $(_ROOT_DIR)/main.mak - -SHIM_DIR := $(MAIN_DIR)/shims - -CFLAGS += -I$(SHIM_DIR) -include windows_shim.h - -shim_src := $(wildcard $(SHIM_DIR)/*.cpp) $(wildcard $(SHIM_DIR)/*.c) \ No newline at end of file diff --git a/makefiles/dnssd_loader-build/dnssd_loader-files.mak b/makefiles/dnssd_loader-build/dnssd_loader-files.mak deleted file mode 100644 index 184161e..0000000 --- a/makefiles/dnssd_loader-build/dnssd_loader-files.mak +++ /dev/null @@ -1,2 +0,0 @@ -dnssd_loader_src := $(wildcard $(LIB_DIR)/dnssd_loader/*.c) $(wildcard $(LIB_DIR)/dnssd_loader/*.cpp) -dnssd_loader_include := -I$(LIB_DIR)/dnssd_loader diff --git a/makefiles/dnssd_loader-build/dnssd_loader.mak b/makefiles/dnssd_loader-build/dnssd_loader.mak deleted file mode 100644 index 6f47bee..0000000 --- a/makefiles/dnssd_loader-build/dnssd_loader.mak +++ /dev/null @@ -1,36 +0,0 @@ -ROOT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) -include $(ROOT_DIR)/../main.mak - -%.c.o : %.c - $(CC) $(CFLAGS) $(EXTRA_FLAGS) -o $@ -c $< - -%.cpp.o : %.cpp - $(CXX) $(CXXFLAGS) $(EXTRA_FLAGS) -o $@ -c $< - -CFLAGS += -DHAVE_CONFIG_H -DDEBUG -O0 -g - - -$(BUILD_DIR)/objs/%.c.o : $(MAIN_DIR)/%.c - mkdir -p $(@D) - $(CC) $(CFLAGS) $(EXTRA_FLAGS) -o $@ -c $< - -$(BUILD_DIR)/objs/%.cpp.o : $(MAIN_DIR)/%.cpp - mkdir -p $(@D) - $(CXX) $(CXXFLAGS) $(EXTRA_FLAGS) -o $@ -c $< - -include $(ROOT_DIR)/dnssd_loader-files.mak - -dnssd_loader_obj := $(dnssd_loader_src:$(MAIN_DIR)/%=$(BUILD_DIR)/objs/%.o) -$(dnssd_loader_obj) : EXTRA_FLAGS := -I$(ROOT_DIR) $(dnssd_loader_include) -$(BUILD_DIR)/dnssd_loader.a : $(dnssd_loader_obj) - ar rcs $@ $^ - -clean:: - rm -f $(dnssd_loader_obj) - rm -f $(BUILD_DIR)/dnssd_loader.a -.PHONY : clean - -all :: $(BUILD_DIR)/dnssd_loader.a -.PHONY : all - -.DEFAULT_GOAL := all diff --git a/makefiles/libimobiledevice-build/config.h_bak b/makefiles/libimobiledevice-build/config.h_bak deleted file mode 100644 index 3e47e73..0000000 --- a/makefiles/libimobiledevice-build/config.h_bak +++ /dev/null @@ -1,45 +0,0 @@ -#define HAVE_ASPRINTF 1 -#define HAVE_DIRENT_D_TYPE 1 -#define HAVE_DLFCN_H 1 -#define HAVE_FVISIBILITY 1 -#define HAVE_GCRYPT_H 1 -#define HAVE_GETIFADDRS 1 -#define HAVE_GMTIME_R 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_LOCALTIME_R 1 -#define HAVE_MALLOC 1 -#define HAVE_MEMMEM 1 -#define HAVE_MEMORY_H 1 -#define HAVE_OPENSSL 1 -#define HAVE_PTHREAD 1 -#define HAVE_PTHREAD_CANCEL 1 -#define HAVE_PTHREAD_PRIO_INHERIT 1 -#define HAVE_REALLOC 1 -#define HAVE_SLEEP 1 -#define HAVE_STDINT_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STPCPY 1 -#define HAVE_STPNCPY 1 -#define HAVE_STRCASECMP 1 -#define HAVE_STRDUP 1 -#define HAVE_STRERROR 1 -#define HAVE_STRINGS_H 1 -#define HAVE_STRING_H 1 -#define HAVE_STRNDUP 1 -#define HAVE_STRPTIME 1 -#define HAVE_SYS_STAT_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_TIMEGM 1 -#define HAVE_TM_TM_GMTOFF 1 -#define HAVE_TM_TM_ZONE 1 -#define HAVE_UNISTD_H 1 -#define HAVE_VASPRINTF 1 -#define PACKAGE_STRING "jitterbug 1.0" -#define __BIG_ENDIAN 4321 -#define __LITTLE_ENDIAN 1234 - -#ifdef __BYTE_ORDER -#undef __BYTE_ORDER -#endif -#define __BYTE_ORDER 1234 - diff --git a/makefiles/libimobiledevice-build/libimobiledevice-files.mak b/makefiles/libimobiledevice-build/libimobiledevice-files.mak deleted file mode 100644 index ddadbdd..0000000 --- a/makefiles/libimobiledevice-build/libimobiledevice-files.mak +++ /dev/null @@ -1,8 +0,0 @@ -libimobiledevice_src += $(wildcard $(LIB_DIR)/libimobiledevice/src/*.c) $(wildcard $(LIB_DIR)/libimobiledevice/common/*.c) -libimobiledevice_src += $(wildcard $(LIB_DIR)/libimobiledevice-glue/src/*.c) -libimobiledevice_src += $(wildcard $(LIB_DIR)/libusbmuxd/src/*.c) -libimobiledevice_src += $(wildcard $(LIB_DIR)/libusbmuxd/common/*.c) -libimobiledevice_include := -I$(LIB_DIR)/libimobiledevice/include -I$(LIB_DIR)/libimobiledevice-glue/include -I$(LIB_DIR)/libimobiledevice -I$(LIB_DIR)/libusbmuxd/include - -libplist_include := -I$(LIB_DIR)/libplist/include -libplist_src := $(wildcard $(LIB_DIR)/libplist/src/*.c) $(LIB_DIR)/libplist/libcnary/node.c $(LIB_DIR)/libplist/libcnary/node_list.c \ No newline at end of file diff --git a/makefiles/libimobiledevice-build/libimobiledevice.mak b/makefiles/libimobiledevice-build/libimobiledevice.mak deleted file mode 100644 index e28f3b7..0000000 --- a/makefiles/libimobiledevice-build/libimobiledevice.mak +++ /dev/null @@ -1,49 +0,0 @@ -ROOT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) -include $(ROOT_DIR)/../main.mak - -%.c.o : %.c - $(CC) $(CFLAGS) $(EXTRA_FLAGS) -o $@ -c $< - -%.cpp.o : %.cpp - $(CXX) $(CXXFLAGS) $(EXTRA_FLAGS) -o $@ -c $< - -CFLAGS += -DHAVE_CONFIG_H -DDEBUG -O0 -g - - -$(BUILD_DIR)/objs/%.c.o : $(MAIN_DIR)/%.c - mkdir -p $(@D) - $(CC) $(CFLAGS) $(EXTRA_FLAGS) -o $@ -c $< - -$(BUILD_DIR)/objs/%.cpp.o : $(MAIN_DIR)/%.cpp - mkdir -p $(@D) - $(CXX) $(CXXFLAGS) $(EXTRA_FLAGS) -o $@ -c $< - -include $(ROOT_DIR)/libimobiledevice-files.mak - -libimobiledevice_obj := $(libimobiledevice_src:$(MAIN_DIR)/%=$(BUILD_DIR)/objs/%.o) -$(libimobiledevice_obj) : EXTRA_FLAGS := -I$(ROOT_DIR) $(libimobiledevice_include) $(libplist_include) -I$(LIB_DIR)/libimobiledevice/common -I$(LIB_DIR)/libusbmuxd/common -$(BUILD_DIR)/libimobiledevice.a : $(libimobiledevice_obj) - ar rcs $@ $^ - -libplist_obj := $(libplist_src:$(MAIN_DIR)/%=$(BUILD_DIR)/objs/%.o) -$(libplist_obj) : EXTRA_FLAGS := -I$(ROOT_DIR) $(libplist_include) -I$(LIB_DIR)/libplist/libcnary/include -I$(LIB_DIR)/libplist/src -$(BUILD_DIR)/libplist.a : $(libplist_obj) - ar rcs $@ $^ - - -#allsrc += $(libimobiledevice_src) -#allsrc += $(libplist_src) -#allobj = $(addsuffix .o, $(allsrc)) - - -clean:: - rm -f $(libimobiledevice_obj) - rm -f $(libplist_obj) - rm -f $(BUILD_DIR)/libplist.a $(BUILD_DIR)/libimobiledevice.a -.PHONY : clean - -all :: $(BUILD_DIR)/libplist.a -all :: $(BUILD_DIR)/libimobiledevice.a -.PHONY : all - -.DEFAULT_GOAL := all diff --git a/makefiles/main.mak b/makefiles/main.mak deleted file mode 100644 index 44c1123..0000000 --- a/makefiles/main.mak +++ /dev/null @@ -1,9 +0,0 @@ -cur_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) -MAIN_DIR := $(dir $(abspath $(cur_dir))) -MAIN_DIR := $(MAIN_DIR:/=) - -BUILD_DIR := $(CURDIR) - -UPSTREAM_DIR := $(MAIN_DIR)/upstream_repo - -LIB_DIR := $(MAIN_DIR)/libraries diff --git a/makefiles/rewrite_altserver_source.py b/patches/altserver.py similarity index 98% rename from makefiles/rewrite_altserver_source.py rename to patches/altserver.py index 13de09c..32213fd 100644 --- a/makefiles/rewrite_altserver_source.py +++ b/patches/altserver.py @@ -12,6 +12,7 @@ content = re.sub(br'\n(std::string StringFromWideString.*?\n\{[\s\S]+?\})', br'/*\1*/', content) content = re.sub(br'\n(std::wstring WideStringFromString.*?\n\{[\s\S]+?\})', br'/*\1*/', content) content = content.replace(b'std::wstring', b'std::string') +content = content.replace(b'int addrlen', b'socklen_t addrlen') content = content.replace(b'std::string_convert', b'std::wstring_convert') content = content.replace(b'boost/filesystem.hpp', b'filesystem') diff --git a/makefiles/AltSign-build/rewrite_altsign_source.py b/patches/altsign.py similarity index 100% rename from makefiles/AltSign-build/rewrite_altsign_source.py rename to patches/altsign.py diff --git a/makefiles/AltSign-build/rewrite_ldid_source.py b/patches/ldid.py similarity index 100% rename from makefiles/AltSign-build/rewrite_ldid_source.py rename to patches/ldid.py diff --git a/shims/old-linux-polyfill.c b/shims/old-linux-polyfill.c index 4387da6..ff723bc 100644 --- a/shims/old-linux-polyfill.c +++ b/shims/old-linux-polyfill.c @@ -1,4 +1,5 @@ #include +#include #include ssize_t getrandom(void *buf, size_t buflen, unsigned int flags) { diff --git a/shims/windows_shim.h b/shims/windows_shim.h index dfc70fc..3a5b2f7 100644 --- a/shims/windows_shim.h +++ b/shims/windows_shim.h @@ -21,6 +21,7 @@ typedef struct timeval TIMEVAL; #ifdef __cplusplus #include +#include #include extern std::string StringFromWideString(std::string wideString); extern std::string WideStringFromString(std::string string); diff --git a/src/common.h b/src/common.h index 3053b68..a5a184a 100644 --- a/src/common.h +++ b/src/common.h @@ -19,5 +19,7 @@ typedef struct timeval TIMEVAL; typedef int BOOL; #ifdef __cplusplus +#include +#include using std::min; #endif \ No newline at end of file diff --git a/upstream_repo b/upstream_repo index 071b1dd..2ef20b3 160000 --- a/upstream_repo +++ b/upstream_repo @@ -1 +1 @@ -Subproject commit 071b1dda13ff4d3623b1e3680ec93dd670ecaf45 +Subproject commit 2ef20b38db9c0aa097481d23750113ab47d8da76