Page MenuHomePhabricator

No OneTemporary

Size
17 KB
Referenced Files
None
Subscribers
None
diff --git a/trunk/README b/trunk/README
index bd5215a..f7d99b1 100644
--- a/trunk/README
+++ b/trunk/README
@@ -1,129 +1,133 @@
FRED README FILE
Table of contents
0.0 Author and license stuff
1.0 What is fred? - A short description
2.0 Installation instructions
2.1 Prerequisits
2.1.1 Linux
2.1.2 Windows
2.2 Install from a package
2.2.1 Linux
2.2.2 Windows
3.0 Building the source
3.1 Shared vs static
3.2 Linux
3.3 Crosscompiling for Windows
3.3.1 Compiler
3.3.2 Qt
3.3.3 Fred
3.3.4 Packaging
0.0 Author and license stuff
fred Copyright (c) 2011-2013 by Gillen Daniel <gillen.dan@pinguin.lu>
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
1.0 What is fred? - A short description
TODO
2.0 Installation instructions
2.1 Prerequisits
2.1.1 Linux
Some sort of Linux with a recent kernel (2.6.x or above) and Qt v4.x.
2.1.2 Windows
Windows XP or newer.
2.2 Install from a package
2.2.1 Linux
Chances are I provide prebuild binary packages for Debian and Ubuntu. In
this case, you only have to fire up your distribution's package manager
and install fred. See https://www.pinguin.lu for more information and
download links. If you added my repository, simpy execute the following
command:
sudo apt-get install fred fred-reports
2.2.2 Windows
See https://www.pinguin.lu for more information and download links.
3.0 Building the source
3.1 Shared vs static
TODO
3.2 Linux
Compiling under Linux for Linux should be very simple. Just execute the
following commands:
cd /path/to/fred/source
- ./autogen.sh linux
+ ./autogen.sh --platform=linux
3.3 Windows
Until beta5, fred for Windows was build under Windows. But it was a pain in
the bud to do so. Therefore I switched to crosscompiling under Linux which
works very well. If you want to build fred under Windows, good luck and
please, don't contact me if you have any problems! My only answer will be:
Crosscompile under Linux!
3.4 Crosscompiling for Windows
The following instructions are for Debian / Ubuntu like distros. If you are
using another distro, you will need to get the compiler and qt on your own.
3.4.1 Compiler
You will need the mingw-w64 gcc and g++ compiler. When using Debian/Ubuntu
install the following packages:
sudo apt-get install mingw-w64 mingw-w64-tools g++-mingw-w64 \
gcc-mingw-w64 mingw-ocaml
3.4.2 Qt
After you have a compiler, you will need to crosscompile Qt as it is
currently not available as package. Start by getting the source:
cd /some/temp/dir/
wget http://download.qt-project.org/official_releases/qt/4.8/4.8.4/qt-everywhere-opensource-src-4.8.4.tar.gz
tar xfvz qt-everywhere-opensource-src-4.8.4.tar.gz
cd qt-everywhere-opensource-src-4.8.4
Unfortunately, Qt won't build until you apply two small patches:
patch -p1 </path/to/fred/qt_patches/mingw32-qt-4.8.0-no-webkit-tests.patch
- patch -p1 </path/to/fred/qt_patches/qt-4.8.4-fix-sse-suppport-build-regression.patch
+ patch -p1 </../qt_patches/qt-4.8.4-fix-sse-suppport-build-regression.patch
Now configure, compile and install Qt (I compiled it on my dual Xeon
machine with 24 cores (using make -j24) which took about 5 minutes. It
might take a bit longer on your machine :-p):
- sudo ./configure -prefix /opt/qt-4.8.4-mingw -opensource -no-qt3support -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-javascript-jit -nomake examples -nomake demos -nomake docs -xplatform win32-g++-4.6 -device-option CROSS_COMPILE=i686-w64-mingw32-
+ sudo ./configure -prefix /opt/qt-4.8.4-mingw -opensource -no-qt3support \
+ -no-multimedia -no-audio-backend -no-phonon \
+ -no-phonon-backend -no-javascript-jit -nomake examples \
+ -nomake demos -nomake docs -xplatform win32-g++-4.6 \
+ -device-option CROSS_COMPILE=i686-w64-mingw32-
sudo make
sudo make install
If you are asking you why the heck I used sudo to run configure, well, Qt
likes to copy some files to the prefix dir in that step which will fail
if you aren't root.
3.4.3 Fred
If all the above worked, you are ready to crosscompile fred:
cd /path/to/fred/source
- ./autogen.sh win32
+ ./autogen.sh --static-hivex --platform=win32
The build process of hivex will probably complain and might even fail
with an error but normally the lib gets build before that without errors,
so just ignore it.
3.4.4 Packaging
TODO
diff --git a/trunk/autogen.sh b/trunk/autogen.sh
index 12ae69a..635ddca 100755
--- a/trunk/autogen.sh
+++ b/trunk/autogen.sh
@@ -1,253 +1,327 @@
#!/bin/bash
# -----------------------------------------------------------------------------
# Default command line options.
# -----------------------------------------------------------------------------
-OPT_JOBS=1
-OPT_ONLY_BOOTSTRAP=0
-OPT_PLATFORM="linux"
-OPT_STATIC_HIVEX=0
+DEFOPT_CREATE_PACKAGE=0
+DEFOPT_JOBS=1
+DEFOPT_ONLY_BOOTSTRAP=0
+DEFOPT_PLATFORM="linux"
+DEFOPT_STATIC_HIVEX=0
-OPT_LINUX_QMAKE=`which qmake`
+DEFOPT_LINUX_QMAKE=`which qmake`
-OPT_WIN32_COMPILER_SUFFIX="i686-w64-mingw32"
-OPT_WIN32_QMAKE="/opt/qt-4.8.4-mingw/bin/qmake"
+DEFOPT_WIN32_COMPILER_SUFFIX="i686-w64-mingw32"
+DEFOPT_WIN32_QMAKE="/opt/qt-4.8.4-mingw/bin/qmake"
+#DEFOPT_WIN32_DLL_PATH="/usr/i686-w64-mingw32/bin"
+DEFOPT_WIN32_QTDLL_PATH="/opt/qt-4.8.4-mingw/bin"
# -----------------------------------------------------------------------------
# ------------------ DO NOT CHANGE ANYTHING BELOW THIS LINE -------------------
# -----------------------------------------------------------------------------
+WIN32_DLLS="libgcc_s_sjlj-1.dll libstdc++-6.dll libiconv-2.dll"
+WIN32_QTDLLS="QtCore4.dll QtGui4.dll QtScript4.dll QtWebKit4.dll QtNetwork4.dll QtWebKit4.dll"
+
# Try to make somehow sure we are running in bash and not some other shell
if [ -z "$BASH_VERSION" ]; then
echo "ERROR: This script must be run in a bash shell! Try using \"bash $0\""
exit 1
fi
# -----------------------------------------------------------------------------
# Function declarations
# -----------------------------------------------------------------------------
# Print usage and exit
PrintUsage() {
echo
echo "Usage:"
echo " $0 [options]"
echo
echo "Options:"
+ echo " --create-package[=0..1] (Def.: $DEFOPT_CREATE_PACKAGE) : Package fred after building (Only supported on Debian/Ubuntu and Win32)."
echo " --help: Print this help message."
- echo " --jobs=<number> (Def.: 1) : Specify how many make jobs should be run simultaneously."
- echo " --linux-qmake=<qmakebin> (Def.: qmake) : Specify the linux qmake binary to use."
- echo " --only-bootstrap[=0..1] (Def.: 0) : Only bootstrap, but do not compile fred."
- echo " --platform=<platform> (Def.: linux) : Specify the platform fred should be build for. Available platforms are 'linux' and 'win32'."
- echo " --static-hivex[=0..1] (Def.: 0): Build and link in-tree hivex statically."
- echo " --win32-compiler-suffix=<suffix> (Def.: i686-w64-mingw32) : Specify the win32 crosscompiler suffix to use."
- echo " --win32-qmake=<qmakebin> (Def.: /opt/qt-4.8.4-mingw/bin/qmake) : Specify the win32 qmake binary to use."
+ echo " --jobs=<number> (Def.: $DEFOPT_JOBS) : Specify how many make jobs should be run simultaneously."
+ echo " --linux-qmake=<qmakebin> (Def.: $DEFOPT_LINUX_QMAKE) : Specify the linux qmake binary to use."
+ echo " --only-bootstrap[=0..1] (Def.: $DEFOPT_ONLY_BOOTSTRAP) : Only bootstrap, but do not compile fred."
+ echo " --platform=<platform> (Def.: $DEFOPT_PLATFORM) : Specify the platform fred should be build for. Available platforms are 'linux' and 'win32'."
+ echo " --static-hivex[=0..1] (Def.: $DEFOPT_STATIC_HIVEX): Build and link in-tree hivex statically."
+ echo " --win32-compiler-suffix=<suffix> (Def.: $DEFOPT_WIN32_COMPILER_SUFFIX) : Specify the win32 crosscompiler suffix to use."
+# echo " --win32-dll-path=<path> (Def.: $DEFOPT_WIN32_DLL_PATH) : Specify path to mingw dll's"
+ echo " --win32-qmake=<qmakebin> (Def.: $DEFOPT_WIN32_QMAKE) : Specify the win32 qmake binary to use."
+ echo " --win32-qtdll-path=<path> (Def.: $DEFOPT_WIN32_QTDLL_PATH) : Specify path to Qt dll's"
echo
exit 1
}
# Extract argument value
get_arg_val() {
local TMP=`echo "$1" | cut -d= -f2`
if [ "$1" = "$TMP" ]; then
# No arg specified for option, assume 1
echo 1
else
if [[ -z "$TMP" || $(echo -n "$TMP" | sed 's/[0-9]//g' | wc -c) -ne 0 ]]; then
echo "ERROR: Non-integer arg for option '$1' specified!" 1>&2
exit 1
fi
echo $TMP
fi
}
# -----------------------------------------------------------------------------
# Parse command line args
# -----------------------------------------------------------------------------
+# Load defaults
+OPT_CREATE_PACKAGE=$DEFOPT_CREATE_PACKAGE
+OPT_JOBS=$DEFOPT_JOBS
+OPT_ONLY_BOOTSTRAP=$DEFOPT_ONLY_BOOTSTRAP
+OPT_PLATFORM="$DEFOPT_PLATFORM"
+OPT_STATIC_HIVEX=$DEFOPT_STATIC_HIVEX
+OPT_LINUX_QMAKE="$DEFOPT_LINUX_QMAKE"
+OPT_WIN32_COMPILER_SUFFIX="$DEFOPT_WIN32_COMPILER_SUFFIX"
+OPT_WIN32_QMAKE="$DEFOPT_WIN32_QMAKE"
+#OPT_WIN32_DLL_PATH="$DEFOPT_WIN32_DLL_PATH"
+OPT_WIN32_QTDLL_PATH="$DEFOPT_WIN32_QTDLL_PATH"
+
+# Parse specified options
shopt extglob &>/dev/null
EXTGLOB=$?
shopt -s extglob &>/dev/null
while :; do
case "$1" in
+ --create-package?(=[01]))
+ OPT_CREATE_PACKAGE=$(get_arg_val "$1") || PrintUsage
+ shift
+ ;;
--help)
PrintUsage
;;
--jobs=*)
OPT_JOBS=$(get_arg_val "$1") || PrintUsage
shift
;;
--linux-qmake=*)
TMP=`echo "$1" | cut -d= -f2`
if [[ -z "$TMP" || "$1" = "$TMP" ]]; then
echo "ERROR: No option arg for '$1' specified!"
PrintUsage
fi
if [ ! -x "$TMP" ]; then
echo "ERROR: The specified linux qmake binary '$TMP' does not exist or is not executable!"
exit 1
fi
OPT_LINUX_QMAKE="$TMP"
shift
;;
--only-bootstrap?(=[01]))
OPT_ONLY_BOOTSTRAP=$(get_arg_val "$1") || PrintUsage
shift
;;
--platform=*)
TMP=`echo "$1" | cut -d= -f2`
if [[ -z "$TMP" || "$1" = "$TMP" ]]; then
echo "ERROR: No option arg for '$1' specified!"
PrintUsage
fi
TMP=`echo "$TMP" | tr "[A-Z]" "[a-z]"`
if [[ "$TMP" != "linux" && "$TMP" != "win32" ]]; then
echo "ERROR: Unsupported platform '$TMP' specified!"
PrintUsage
fi
OPT_PLATFORM="$TMP"
shift
;;
--static-hivex?(=[01]))
OPT_STATIC_HIVEX=$(get_arg_val "$1") || PrintUsage
shift
;;
--win32-compiler-suffix=*)
TMP=`echo "$1" | cut -d= -f2`
if [[ -z "$TMP" || "$1" = "$TMP" ]]; then
echo "ERROR: No option arg for '$1' specified!"
PrintUsage
fi
if [[ ! -x "$(which \"${TMP}-gcc\")" || ! -x "$(which \"${TMP}-g++\")" ]]; then
echo "ERROR: Couldn't find '${TMP}-gcc' or '${TMP}-g++'!"
echo "ERROR: The specified win32 compiler suffix does not seem to be correct!"
exit 1
fi
OPT_WIN32_COMPILER_SUFFIX="$TMP"
shift
;;
--win32-qmake=*)
TMP=`echo "$1" | cut -d= -f2`
if [[ -z "$TMP" || "$1" = "$TMP" ]]; then
echo "ERROR: No option arg for '$1' specified!"
PrintUsage
fi
if [ ! -x "$TMP" ]; then
echo "ERROR: The specified win32 qmake binary '$TMP' does not exist or is not executable!"
exit 1
fi
OPT_WIN32_QMAKE="$TMP"
shift
;;
+ --win32-qtdll-path=*)
+ TMP=`echo "$1" | cut -d= -f2`
+ if [[ -z "$TMP" || "$1" = "$TMP" ]]; then
+ echo "ERROR: No option arg for '$1' specified!"
+ PrintUsage
+ fi
+ if [ ! -d "$TMP" ]; then
+ echo "ERROR: The specified Qt dll path '$TMP' does not exist or is not a directory!"
+ exit 1
+ fi
+ OPT_WIN32_QTDLL_PATH="$TMP"
+ shift
+ ;;
--*)
echo "ERROR: Unknown option / Wrong option arg '$1' specified!" 1>&2
PrintUsage
;;
*)
break
;;
esac
done
if [ $EXTGLOB -ne 0 ]; then
shopt -u extglob &>/dev/null
fi
# -----------------------------------------------------------------------------
# Check command line args
# -----------------------------------------------------------------------------
if [ "$OPT_PLATFORM" = "linux" ]; then
if [ ! -x "$OPT_LINUX_QMAKE" ]; then
echo "ERROR: Couldn't find qmake! Consider specifying it with --linux-qmake."
exit 1
fi
fi
if [ "$OPT_PLATFORM" = "win32" ]; then
if [ ! -x "$OPT_WIN32_QMAKE" ]; then
echo "ERROR: Couldn't find qmake! Consider specifying it with --win32-qmake."
exit 1
fi
fi
# -----------------------------------------------------------------------------
# Build
# -----------------------------------------------------------------------------
# Get script directory and cd to it
SCRIPT_DIR=`dirname "$0"`
(
cd "$SCRIPT_DIR"
# When requested to build static, init, bootstrap, configure and make hivex
if [ $OPT_STATIC_HIVEX -eq 1 ]; then
echo "-----------------------------------------------------------------------------"
echo "Bootstrapping fred"
echo "-----------------------------------------------------------------------------"
(
git submodule init
git submodule update
)
echo "-----------------------------------------------------------------------------"
echo "Bootstrapping hivex"
echo "-----------------------------------------------------------------------------"
(
cd hivex
if [ "$OPT_PLATFORM" = "linux" ]; then
./autogen.sh --disable-ocaml --disable-perl --disable-python --disable-ruby --disable-shared || exit 1
fi
if [ "$OPT_PLATFORM" = "win32" ]; then
./autogen.sh --host=$OPT_WIN32_COMPILER_SUFFIX --disable-ocaml --disable-perl --disable-python --disable-ruby --disable-shared || exit 1
fi
)
[ $? -ne 0 ] && exit 1
echo "-----------------------------------------------------------------------------"
echo "Building hivex"
echo "-----------------------------------------------------------------------------"
(
cd hivex
make clean &>/dev/null
make -j$OPT_JOBS || exit 1
)
[ $? -ne 0 ] && [ "$OPT_PLATFORM" != "win32" ] && exit 1
fi
- if [ $OPT_ONLY_BOOTSTRAP -eq 0 ]; then
+ # Exit if we had only to bootstrap
+ [ $OPT_ONLY_BOOTSTRAP -eq 1 ] && exit 0
+
+ # Building is done while packaging on Linux
+ if [[ ! ( "$OPT_PLATFORM" = "linux" && $OPT_CREATE_PACKAGE -eq 1 ) ]]; then
echo "-----------------------------------------------------------------------------"
echo "Building fred"
echo "-----------------------------------------------------------------------------"
make distclean &>/dev/null
if [ "$OPT_PLATFORM" = "linux" ]; then
if [ $OPT_STATIC_HIVEX -eq 0 ]; then
$OPT_LINUX_QMAKE || exit 1
else
$OPT_LINUX_QMAKE HIVEX_STATIC=1 || exit 1
fi
make clean &>/dev/null
- make -j$OPT_JOBS || exit 1
+ make -j$OPT_JOBS release || exit 1
fi
if [ "$OPT_PLATFORM" = "win32" ]; then
if [ $OPT_STATIC_HIVEX -eq 0 ]; then
$OPT_WIN32_QMAKE || exit 1
else
$OPT_WIN32_QMAKE HIVEX_STATIC=1 || exit 1
fi
make clean &>/dev/null
- make -j$OPT_JOBS || exit 1
+ make -j$OPT_JOBS release || exit 1
+ fi
+ fi
+
+ # Exit if we don't need to package fred
+ [ $OPT_CREATE_PACKAGE -eq 0 ] && exit 0
+
+ echo "-----------------------------------------------------------------------------"
+ echo "Packaging fred"
+ echo "-----------------------------------------------------------------------------"
+ if [ "$OPT_PLATFORM" = "linux" ]; then
+ if [ ! -x "$(which dpkg-buildpackage)" ]; then
+ echo "ERROR: Couldn't find dpkg-buildpackage!"
+ exit 1
fi
+ dpkg-buildpackage -rfakeroot -b || exit 1
+ fi
+ if [ "$OPT_PLATFORM" = "win32" ]; then
+ # Delete old package directory if it exists and (re)create it
+ rm -rf fred-win32 &>/dev/null
+ mkdir fred-win32
+ # Copy fred.exe
+ cp -v release/fred.exe fred-win32/
+ # Find and copy mingw dll's
+ for F in $WIN32_DLLS; do
+ find /usr -name "$F" -path "*/$OPT_WIN32_COMPILER_SUFFIX/*" -exec cp -v "{}" fred-win32/ \; || exit 1
+ done
+ # Copy Qt dll's
+ for F in $WIN32_QTDLLS; do
+ cp -v "$OPT_WIN32_QTDLL_PATH/$F" fred-win32/ || exit 1
+ done
+ # Copy report templates
+ cp -rv report_templates fred-win32/ || exit 1
fi
)
if [ $? -eq 0 ]; then
echo "-----------------------------------------------------------------------------"
echo "All done."
echo "-----------------------------------------------------------------------------"
else
echo "-----------------------------------------------------------------------------"
echo "An error occured while building! See output above for details."
echo "-----------------------------------------------------------------------------"
fi

File Metadata

Mime Type
text/x-diff
Expires
Mon, Dec 23, 11:35 AM (12 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1176863
Default Alt Text
(17 KB)

Event Timeline