Use autotools to build project

This commit is contained in:
Nikias Bassen 2016-12-28 17:43:26 +01:00
parent d0a1b80a7f
commit 2c0aaf0b82
5 changed files with 70 additions and 58 deletions

View file

@ -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)

3
Makefile.am Normal file
View file

@ -0,0 +1,3 @@
AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = external/idevicerestore external/img4tool external/tsschecker futurerestore

26
autogen.sh Executable file
View file

@ -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

34
configure.ac Normal file
View file

@ -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
])

View file

@ -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