实现 dyninst 离线安装

若想实现 dyninst 离线安装,只需要把源码目录下 cmake/packages.cmake 依赖包的下载规则改下,把 URL 改成 SOURCE_DIR。然后在对应的路径下放上解压的依赖源码。

提前下载并解压好依赖源码包:

1
2
3
4
5
6
lhx@vm:~/dyninst/packages$ ls
binutils-2.23 boost_1_61_0 dwarf-20130126 elfutils-0.168.tar.bz2
binutils-2.23.tar.gz boost_1_61_0.zip elfutils-0.168 libdwarf-20130126.tar.gz
lhx@vm:~/dyninst/packages$ pwd
/home/lhx/dyninst/packages
lhx@vm:~/dyninst/packages$

cmake/packages.cmake 具体修改如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
diff --git a/packages.cmake b/packages.cmake
index c9fb42a..23c8d56 100644
--- a/packages.cmake
+++ b/packages.cmake
@@ -6,7 +6,7 @@ if (UNIX)
include(ExternalProject)
ExternalProject_Add(LibElf
PREFIX ${CMAKE_BINARY_DIR}/libelf
- URL https://sourceware.org/elfutils/ftp/0.168/elfutils-0.168.tar.bz2
+ SOURCE_DIR /home/lhx/dyninst/packages/elfutils-0.168
CONFIGURE_COMMAND <SOURCE_DIR>/configure --enable-shared --prefix=${CMAKE_BINARY_DIR}/libelf
BUILD_COMMAND make -C libelf
INSTALL_COMMAND make -C libelf install
@@ -36,7 +36,7 @@ if (UNIX)
DEPENDS libelf_imp
# URL http://reality.sgiweb.org/davea/libdwarf-20130126.tar.gz
# URL http://sourceforge.net/p/libdwarf/code/ci/20130126/tarball
- URL http://www.paradyn.org/libdwarf/libdwarf-20130126.tar.gz
+ SOURCE_DIR /home/lhx/dyninst/packages/dwarf-20130126
# GIT_REPOSITORY git://git.code.sf.net/p/libdwarf/code libdwarf-code
# GIT_TAG 20130126
CONFIGURE_COMMAND CFLAGS=-I${LIBELF_INCLUDE_DIR} LDFLAGS=-L${CMAKE_BINARY_DIR}/libelf/lib <SOURCE_DIR>/libdwarf/configure --enable-shared
@@ -65,7 +65,7 @@ if (UNIX)
include(ExternalProject)
ExternalProject_Add(LibIberty
PREFIX ${CMAKE_BINARY_DIR}/binutils
- URL http://ftp.gnu.org/gnu/binutils/binutils-2.23.tar.gz
+ SOURCE_DIR /home/lhx/dyninst/packages/binutils-2.23
CONFIGURE_COMMAND CFLAGS=-fPIC CPPFLAGS=-fPIC PICFLAG=-fPIC <SOURCE_DIR>/libiberty/configure --prefix=${CMAKE_BINARY_DIR}/libiberty --enable-shared
BUILD_COMMAND make all
INSTALL_DIR ${CMAKE_BINARY_DIR}/libiberty
@@ -167,8 +167,7 @@ if(NOT Boost_FOUND)
include(ExternalProject)
ExternalProject_Add(boost
PREFIX ${CMAKE_BINARY_DIR}/boost
- URL http://downloads.sourceforge.net/project/boost/boost/1.61.0/boost_1_61_0.zip
- URL_MD5 015ae4afa6f3e597232bfe1dab949ace
+ SOURCE_DIR /home/lhx/dyninst/packages/boost_1_61_0
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ${BOOST_BOOTSTRAP} --prefix=${CMAKE_INSTALL_PREFIX}
BUILD_COMMAND ${BOOST_BUILD} ${BOOST_ARGS} stage