From 2c0aaf0b823511146717f5fa1169cad68262b1aa Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Wed, 28 Dec 2016 17:43:26 +0100 Subject: [PATCH] Use autotools to build project --- Makefile | 58 --------------------------------------- Makefile.am | 3 ++ autogen.sh | 26 ++++++++++++++++++ configure.ac | 34 +++++++++++++++++++++++ futurerestore/Makefile.am | 7 +++++ 5 files changed, 70 insertions(+), 58 deletions(-) delete mode 100644 Makefile create mode 100644 Makefile.am create mode 100755 autogen.sh create mode 100644 configure.ac create mode 100644 futurerestore/Makefile.am diff --git a/Makefile b/Makefile deleted file mode 100644 index 39db83c1..00000000 --- a/Makefile +++ /dev/null @@ -1,58 +0,0 @@ -TARGET = futurerestore_tool -INSTALLTARGET = futurerestore -CXX = g++ -CC = gcc -INCLUDE += -I/usr/local/include -I futurerestore -I /opt/local/include -I external/idevicerestore/src -I external/tsschecker/tsschecker -I external/img4tool/img4tool -CFLAGS += $(INCLUDE) -Wall -std=c11 -D HAVE_CONFIG_H=1 -CXXFLAGS += $(INCLUDE) -Wall -std=c++11 - -LDFLAGS += -L/opt/local/lib -L/usr/local/lib -lirecovery -limobiledevice -lcrypto -lcurl -lplist -lc -lc++ -lzip -lfragmentzip -lz - -OBJECTS += futurerestore.o -SRC_DIR = futurerestore -OBJECTS_COMBINED = $(OBJECTS:%.o=$(SRC_DIR)/%.o) - -DEPOBJECTS_TSSCHECKER += tsschecker.o jsmn.o download.o tss.o -DEPOBJECTS_IMG4TOOL += img4tool.o img4.o -DEPOBJECTS_IDEVICERESTORE += common.o img3.o img4.o download.o asr.o fdr.o fls.o dfu.o ipsw.o limera1n.o locking.o mbn.o normal.o recovery.o restore.o socket.o thread.o - -PATH_TSSCHECKER = external/tsschecker/tsschecker -PATH_IMG4TOOL = external/img4tool/img4tool -PATH_IDEVICERESTORE = external/idevicerestore/src - -DEPOBJECTS_TSSCHECKER_COMBINED = $(DEPOBJECTS_TSSCHECKER:%.o=$(PATH_TSSCHECKER)/%.o) -DEPOBJECTS_IMG4TOOL_COMBINED = $(DEPOBJECTS_IMG4TOOL:%.o=$(PATH_IMG4TOOL)/%.o) -DEPOBJECTS_IDEVICERESTORE_COMBINED = $(DEPOBJECTS_IDEVICERESTORE:%.o=$(PATH_IDEVICERESTORE)/%.o) - - -all : $(TARGET) - - -ALLDEPS = $(DEPOBJECTS_TSSCHECKER_COMBINED) $(DEPOBJECTS_IMG4TOOL_COMBINED) $(DEPOBJECTS_IDEVICERESTORE_COMBINED) $(PATH_IDEVICERESTORE)/idevicerestore.o $(OBJECTS_COMBINED) -$(TARGET) : $(ALLDEPS) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(ALLDEPS) $(SRC_DIR)/main.cpp -o $(TARGET) - @echo "Successfully built $(TARGET)" - -$(OBJECTS_COMBINED) : $(OBJECTS_COMBINED:%.o=%.cpp) - $(CXX) $(CXXFLAGS) $< -c -o $@ - -$(DEPOBJECTS_TSSCHECKER_COMBINED) : - CFLAGS='-D HAVE_CONFIG_H=1 -I ../../futurerestore' make -C external/tsschecker $(DEPOBJECTS_TSSCHECKER:%.o=tsschecker/%.o) - -$(DEPOBJECTS_IDEVICERESTORE_COMBINED) : $(DEPOBJECTS_IDEVICERESTORE_COMBINED:%.o=%.c) - $(CC) $(CFLAGS) $(@:%.o=%.c) -c -o $@ - -$(PATH_IDEVICERESTORE)/idevicerestore.o : $(PATH_IDEVICERESTORE)/idevicerestore.c - $(CC) $(CFLAGS) -c $(PATH_IDEVICERESTORE)/idevicerestore.c -o $(PATH_IDEVICERESTORE)/idevicerestore.o - -$(PATH_IMG4TOOL)/img4tool.o : - CFLAGS='-D HAVE_CONFIG_H=1 -I ../../futurerestore' make -C external/img4tool objects - -install : - cp $(TARGET) /usr/local/bin/$(INSTALLTARGET) - @echo "Installed $(INSTALLTARGET)" -clean : - make -C external/tsschecker clean - make -C external/img4tool clean - rm -rf external/idevicerestore/src/*.o - rm -rf futurerestore/*.o $(TARGET) diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..5f2a728a --- /dev/null +++ b/Makefile.am @@ -0,0 +1,3 @@ +AUTOMAKE_OPTIONS = foreign +ACLOCAL_AMFLAGS = -I m4 +SUBDIRS = external/idevicerestore external/img4tool external/tsschecker futurerestore diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 00000000..697dcb8a --- /dev/null +++ b/autogen.sh @@ -0,0 +1,26 @@ +#!/bin/sh +gprefix=`which glibtoolize 2>&1 >/dev/null` +if [ $? -eq 0 ]; then + glibtoolize --force +else + libtoolize --force +fi +aclocal -I m4 +autoheader +automake --add-missing +autoconf + +export NOCONFIGURE=1 + +SUBDIRS="external/idevicerestore external/img4tool external/tsschecker" +for SUB in $SUBDIRS; do + pushd $SUB + ./autogen.sh + popd +done + +unset NOCONFIGURE + +if [ -z "$NOCONFIGURE" ]; then + ./configure "$@" +fi diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..86844d22 --- /dev/null +++ b/configure.ac @@ -0,0 +1,34 @@ +AC_PREREQ(2.64) +AC_INIT([futurerestore], [1.0], [http://url.me/issues],, [http://url.me]) + +AC_CANONICAL_SYSTEM +AM_INIT_AUTOMAKE + +CFLAGS="-DIDEVICERESTORE_NOMAIN=1 -DIMG4TOOL_NOMAIN=1 -DTSSCHECKER_NOMAIN=1" + +AC_DEFUN([AX_UNPRECIOUS], [ + m4_define([_AC_PRECIOUS_VARS], m4_bpatsubst(_AC_PRECIOUS_VARS, [$1 +], [])) +]) +AX_UNPRECIOUS([CFLAGS]) +export CFLAGS + +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIRS([m4]) +AC_CONFIG_SUBDIRS(external/idevicerestore external/img4tool external/tsschecker) +AC_CONFIG_SRCDIR([futurerestore]) + +PKG_CHECK_MODULES(libplist, libplist >= 1.12) +PKG_CHECK_MODULES(libzip, libzip >= 0.10) +PKG_CHECK_MODULES(libimobiledevice, libimobiledevice-1.0 >= 1.2.1) +PKG_CHECK_MODULES(libfragmentzip, libfragmentzip >= 1.0) + +AC_PROG_CC +AC_PROG_CXX + +LT_INIT + +AC_OUTPUT([ +Makefile +futurerestore/Makefile +]) diff --git a/futurerestore/Makefile.am b/futurerestore/Makefile.am new file mode 100644 index 00000000..4a09fccc --- /dev/null +++ b/futurerestore/Makefile.am @@ -0,0 +1,7 @@ +AM_CFLAGS = $(libplist_CFLAGS) $(libzip_CFLAGS) $(libimobiledevice_CFLAGS) $(libfragmentzip_CFLAGS) -I$(top_srcdir)/external/tsschecker/tsschecker -I$(top_srcdir)/external/img4tool/img4tool -I$(top_srcdir)/external/idevicerestore/src -std=c++11 +AM_LDFLAGS = $(libplist_LIBS) $(libzip_LIBS) $(libimobiledevice_LIBS) $(libfragmentzip_LIBS) + +bin_PROGRAMS = futurerestore +futurerestore_CXXFLAGS = $(AM_CFLAGS) +futurerestore_LDADD = $(AM_LDFLAGS) $(top_srcdir)/external/idevicerestore/src/libidevicerestore.la $(top_srcdir)/external/img4tool/img4tool/libimg4tool.la $(top_srcdir)/external/tsschecker/tsschecker/libtsschecker.la +futurerestore_SOURCES = futurerestore.cpp main.cpp