aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author1Conan <7620342+1Conan@users.noreply.github.com>2021-11-05 01:47:21 +0800
committerGitHub <noreply@github.com>2021-11-04 13:47:21 -0400
commitc1662728c3a87abda8aa737a334539d4189ab18b (patch)
treed65949caaceb10ee97d2dff2ce75d07e56e56d4c
parentdf1cc52eccb739c2561e6002b18dee0c48137f1a (diff)
downloadldid-c1662728c3a87abda8aa737a334539d4189ab18b.tar.gz
ldid-c1662728c3a87abda8aa737a334539d4189ab18b.tar.zst
ldid-c1662728c3a87abda8aa737a334539d4189ab18b.zip
Cleanup and switch to a Makefile (#7)
-rw-r--r--.github/workflows/build.yml13
-rw-r--r--.gitignore7
-rw-r--r--.gitmodules3
-rw-r--r--Makefile40
-rw-r--r--control12
-rwxr-xr-xcontrol.sh5
-rwxr-xr-xdeb.sh10
-rw-r--r--docs/ldid.1 (renamed from ldid.1)0
-rw-r--r--docs/ldid.1.zh_TW (renamed from ldid.1.zh_TW)0
-rwxr-xr-xios.sh2
m---------libplist0
-rwxr-xr-xmake.sh90
-rwxr-xr-xplist.sh2
-rw-r--r--sha1.h64
-rwxr-xr-xsysroot.sh31
-rwxr-xr-xversion.sh2
16 files changed, 47 insertions, 234 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 37252dd..1fe67fb 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -109,9 +109,9 @@ jobs:
- name: build
run: |
export LDID_VERSION=$(echo "$(git describe --tags --abbrev=0)")
- ${CC} ${CFLAGS} -c -o lookup2.o lookup2.c
- ${CXX} ${CFLAGS} -c -o ldid.o ldid.cpp -std=c++11 -DLDID_VERSION=\"${LDID_VERSION}\"
- ${CXX} ${CFLAGS} -std=c++11 ldid.o lookup2.o ${LIBPLIST_LIB} ${LIBCRYPTO_LIB} -o ldid
+ make -j$(nproc) \
+ VERSION="${LDID_VERSION}" \
+ LIBS="${LIBPLIST_LIB} ${LIBCRYPTO_LIB}"
${TRIPLE}-strip ldid
- uses: actions/upload-artifact@v1
@@ -207,9 +207,10 @@ jobs:
- name: build
run: |
export LDID_VERSION=$(echo "$(git describe --tags --abbrev=0)")
- ${CC} ${CFLAGS} -flto=thin -Os -c -o lookup2.o lookup2.c
- ${CXX} ${CFLAGS} -flto=thin -Os -c -o ldid.o ldid.cpp -std=c++11 -DLDID_VERSION=\"${LDID_VERSION}\"
- ${CXX} ${LIBPLIST_LIB} ${LIBCRYPTO_LIB} -flto=thin -Os -std=c++11 ldid.o lookup2.o -o ldid
+ make -j$(sysctl -n hw.ncpu) \
+ CFLAGS="${CFLAGS} -flto=thin" \
+ VERSION="${LDID_VERSION}" \
+ LIBS="${LIBPLIST_LIB} ${LIBCRYPTO_LIB}"
strip ldid
- uses: actions/upload-artifact@v1
diff --git a/.gitignore b/.gitignore
index edf9bc5..994aaa8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,2 @@
-ios
-out
ldid
-ldid.deb
-debs
*.o
-_
-sysroot32
-sysroot64
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index 5b41a81..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "libplist"]
- path = libplist
- url = https://github.com/libimobiledevice/libplist.git
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6efccc4
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,40 @@
+VERSION ?= 2.1.5
+
+CC ?= cc
+CXX ?= c++
+INSTALL ?= install
+LN ?= ln
+
+CFLAGS ?= -O2 -pipe
+CXXFLAGS ?= $(CFLAGS)
+LDFLAGS ?=
+
+PREFIX ?= /usr/local
+
+BINDIR ?= $(PREFIX)/bin
+MANDIR ?= $(PREFIX)/share/man
+
+SRC := $(wildcard *.c) $(wildcard *.cpp)
+LIBS ?= -lcrypto -lplist-2.0
+
+all: ldid
+
+%.c.o: %.c
+ $(CC) -c $(CFLAGS) -I. $< -o $@
+
+%.cpp.o: %.cpp
+ $(CXX) -c -std=c++11 $(CXXFLAGS) -I. -DLDID_VERSION=\"$(VERSION)\" $< -o $@
+
+ldid: $(SRC:%=%.o)
+ $(CXX) $^ $(LDFLAGS) $(LIBS) -o ldid
+
+install: all
+ $(INSTALL) -D -m755 ldid $(DESTDIR)$(BINDIR)/ldid
+ $(LN) -sf ldid $(DESTDIR)$(BINDIR)/ldid2
+ $(INSTALL) -D -m644 docs/ldid.1 $(DESTDIR)$(MANDIR)/man1/ldid.1
+ $(INSTALL) -D -m644 docs/ldid.1.zh_TW $(DESTDIR)$(MANDIR)/zh_TW/man1/ldid.1
+
+clean:
+ rm -rf ldid *.o
+
+.PHONY: all clean install
diff --git a/control b/control
deleted file mode 100644
index 73136be..0000000
--- a/control
+++ /dev/null
@@ -1,12 +0,0 @@
-Package: ldid
-Priority: optional
-Section: Development
-Maintainer: Jay Freeman (saurik) <saurik@saurik.com>
-Architecture: iphoneos-arm
-Version:
-Description: pseudo-codesign Mach-O files
-Name: Link Identity Editor
-Author: Jay Freeman (saurik) <saurik@saurik.com>
-Depiction: http://cydia.saurik.com/info/ldid/
-Depends: libplist (>= 2.0.0), openssl
-Tag: purpose::console, role::developer
diff --git a/control.sh b/control.sh
deleted file mode 100755
index 7a11d56..0000000
--- a/control.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-dir=$1
-dir=${dir:=_}
-sed -e "s@^\(Version:.*\)@\1$(./version.sh)@" control
-echo "Installed-Size: $(du -s "${dir}" | cut -f 1)"
diff --git a/deb.sh b/deb.sh
deleted file mode 100755
index 3fb31a5..0000000
--- a/deb.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-rm -rf _
-mkdir -p _/usr/bin
-cp -a ios/ldid _/usr/bin/ldid
-mkdir -p _/DEBIAN
-./control.sh _ >_/DEBIAN/control
-mkdir -p debs
-ln -sf debs/ldid_$(./version.sh)_iphoneos-arm.deb ldid.deb
-dpkg-deb -b _ ldid.deb
-readlink ldid.deb
diff --git a/ldid.1 b/docs/ldid.1
index fdab9ed..fdab9ed 100644
--- a/ldid.1
+++ b/docs/ldid.1
diff --git a/ldid.1.zh_TW b/docs/ldid.1.zh_TW
index 257b4b1..257b4b1 100644
--- a/ldid.1.zh_TW
+++ b/docs/ldid.1.zh_TW
diff --git a/ios.sh b/ios.sh
deleted file mode 100755
index f4c112c..0000000
--- a/ios.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-./make.sh true
diff --git a/libplist b/libplist
deleted file mode 160000
-Subproject 9ca25d293fe7f8aca8d952fc7bb91464fe2d34a
diff --git a/make.sh b/make.sh
deleted file mode 100755
index 9c5361b..0000000
--- a/make.sh
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/bin/bash
-
-set -e
-shopt -s extglob
-
-if [[ $# == 0 ]]; then
- ios=false
-else
- ios=$1
- shift
-fi
-
-export DEVELOPER_DIR=/Applications/Xcode-5.1.1.app
-
-os=()
-
-if "${ios}"; then
-
-out=ios
-flags=(cycc -- -miphoneos-version-min=2.0 -arch armv6 -arch arm64)
-
-flags+=(-Xarch_armv6 -Isysroot32/usr/include)
-flags+=(-Xarch_arm64 -Isysroot64/usr/include)
-
-flags+=(-Xarch_armv6 -Lsysroot32/usr/lib)
-flags+=(-Xarch_arm64 -Lsysroot64/usr/lib)
-
-static=false
-flags+=(-framework CoreFoundation)
-
-flags+=(-lplist)
-flags+=(-lcrypto)
-
-else
-
-out=out
-
-if which xcrun &>/dev/null; then
- flags=(xcrun -sdk macosx g++)
- flags+=(-mmacosx-version-min=10.4)
-
- for arch in i386 x86_64; do
- flags+=(-arch "${arch}")
- done
-else
- flags=(g++)
-fi
-
-#flags+=(-L../../lib-osx/openssl)
-
-# XXX: cannot redistribute
-static=true
-flags+=(-Isysroot64/usr/include)
-flags+=(-lcrypto)
-#flags+=(-Wl,/usr/lib/libcrypto.42.dylib)
-
-fi
-
-sdk=$(xcodebuild -sdk iphoneos -version Path)
-
-flags+=(-I.)
-
-if ${static}; then
-
-flags+=(-I"${sdk}"/usr/include/libxml2)
-flags+=(-Ilibplist/include)
-flags+=(-Ilibplist/libcnary/include)
-
-for c in libplist/libcnary/!(cnary).c libplist/src/*.c; do
- o=${c%.c}.o
- o="${out}"/${o##*/}
- os+=("${o}")
- if [[ "${c}" -nt "${o}" ]]; then
- "${flags[@]}" -c -o "${o}" -x c "${c}"
- fi
-done
-
-fi
-
-flags+=("$@")
-
-mkdir -p "${out}"
-set -x
-
-"${flags[@]}" -O3 -g0 -c -std=c++11 -o "${out}"/ldid.o ldid.cpp
-"${flags[@]}" -O3 -g0 -o "${out}"/ldid "${out}"/ldid.o "${os[@]}" -x c lookup2.c -lxml2 -framework Security
-
-if ! "${ios}"; then
- ln -sf out/ldid .
-fi
diff --git a/plist.sh b/plist.sh
deleted file mode 100755
index bda6327..0000000
--- a/plist.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-./configure CC='clang -mmacosx-version-min=10.4 -arch i386 -arch x86_64' CXX='clang++ -mmacosx-version-min=10.4 -arch i386 -arch x86_64' CPP='clang -E' CXXCPP='clang++ -E' libxml2_LIBS=-lxml2 libxml2_CFLAGS=-I/usr/include/libxml2 --enable-static --disable-shared
diff --git a/sha1.h b/sha1.h
deleted file mode 100644
index 32a62a3..0000000
--- a/sha1.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * sha1.h
- *
- * Description:
- * This is the header file for code which implements the Secure
- * Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
- * April 17, 1995.
- *
- * Many of the variable names in this code, especially the
- * single character names, were used because those were the names
- * used in the publication.
- *
- * Please read the file sha1.c for more information.
- *
- */
-
-#ifndef _SHA1_H_
-#define _SHA1_H_
-
-#include <stdint.h>
-
-#ifndef _SHA_enum_
-#define _SHA_enum_
-enum
-{
- shaSuccess = 0,
- shaNull, /* Null pointer parameter */
- shaInputTooLong, /* input data too long */
- shaStateError /* called Input after Result */
-};
-#endif
-#define SHA1HashSize 20
-
-/*
- * This structure will hold context information for the SHA-1
- * hashing operation
- */
-typedef struct SHA1Context
-{
- uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest */
-
- uint32_t Length_Low; /* Message length in bits */
- uint32_t Length_High; /* Message length in bits */
-
- /* Index into message block array */
- int_least16_t Message_Block_Index;
- uint8_t Message_Block[64]; /* 512-bit message blocks */
-
- int Computed; /* Is the digest computed? */
- int Corrupted; /* Is the message digest corrupted? */
-} SHA1Context;
-
-/*
- * Function Prototypes
- */
-
-int SHA1Reset( SHA1Context *);
-int SHA1Input( SHA1Context *,
- const uint8_t *,
- unsigned int);
-int SHA1Result( SHA1Context *,
- uint8_t Message_Digest[SHA1HashSize]);
-
-#endif
diff --git a/sysroot.sh b/sysroot.sh
deleted file mode 100755
index e595621..0000000
--- a/sysroot.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-set -e
-
-rm -rf sysroot32 sysroot64
-mkdir -p sysroot32 sysroot64
-
-function merge() {
- wget --no-check-certificate "${apt}/$1"
- dpkg-deb -x "$1" .
-}
-
-pushd sysroot32
-apt=http://apt.saurik.com/debs
-merge openssl_0.9.8zg-13_iphoneos-arm.deb
-merge libplist_2.0.0-1_iphoneos-arm.deb
-popd
-
-pushd sysroot64
-apt=https://apt.bingner.com/debs/1443.00
-merge libssl1.0_1.0.2q-1_iphoneos-arm.deb
-merge libssl-dev_1.0.2q-1_iphoneos-arm.deb
-merge libplist_2.0.0-1_iphoneos-arm.deb
-popd
-
-for lib in libplist libcrypto; do
- for dylib in sysroot*/usr/lib/"${lib}".*.dylib; do
- echo install_name_tool -id /usr/lib/"${lib}".dylib "${dylib}"
- chmod 755 "${dylib}"
- install_name_tool -id /usr/lib/"${lib}".dylib "${dylib}"
- done
-done
diff --git a/version.sh b/version.sh
deleted file mode 100755
index 19212f3..0000000
--- a/version.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-echo "$(git describe --tags --dirty="+" --match="v*" | sed -e 's@-\([^-]*\)-\([^-]*\)$@+\1.\2@;s@^v@2:@')"