aboutsummaryrefslogtreecommitdiff
path: root/tools/depends/target/libssh/Makefile
blob: d2f67381eb489cdd58de021ad3daac96c5d1896b (plain)
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
42
43
44
45
include ../../Makefile.include
DEPS= ../../Makefile.include Makefile removelegacy.patch android.patch ntohl.patch md5.patch

# lib name, version
LIBNAME=libssh
VERSION=0.7.0a
SOURCE=$(LIBNAME)-$(VERSION)
ARCHIVE=$(SOURCE).tar.gz

LIBDYLIB=$(PLATFORM)/build/src/$(LIBNAME).a

all: .installed-$(PLATFORM)

$(TARBALLS_LOCATION)/$(ARCHIVE):
	cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)

$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
	rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
	cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
	cd $(PLATFORM); rm -rf build; mkdir -p build
	cd $(PLATFORM); patch -p0 < ../removelegacy.patch
	cd $(PLATFORM); patch -p0 < ../android.patch
	cd $(PLATFORM); patch -p0 < ../ntohl.patch
	cd $(PLATFORM); patch -p0 < ../md5.patch
	cd $(PLATFORM); patch -p1 < ../darwin.patch
	cd $(PLATFORM); patch -p0 < ../fix-gcc-5-compile.patch
	sed -ie "s|-fstack-protector|-fno-stack-protector|" "$(PLATFORM)/cmake/Modules/DefineCompilerFlags.cmake"
	sed -ie "s|add_subdirectory(examples)||" "$(PLATFORM)/CMakeLists.txt"
	cd $(PLATFORM)/build; $(CMAKE) -DWITH_STATIC_LIB=1 -DWITH_EXAMPLES=0 -DTHREADS_PTHREAD_ARG=0 -DWITH_GSSAPI=0 VERBOSE=1 ..

$(LIBDYLIB): $(PLATFORM)
	make -j 1 -C $(PLATFORM)/build

.installed-$(PLATFORM): $(LIBDYLIB)
	make -C $(PLATFORM)/build install
	rm -f $(PREFIX)/lib/libssh.so $(PREFIX)/lib/libssh.so.4.3.0 $(PREFIX)/lib/libssh.so.4
	rm -f $(PREFIX)/lib/libssh.*dylib*
	rm -f $(PREFIX)/lib/libssh_threads.*dylib*
	touch $@

clean:
	rm -rf $(PLATFORM) .installed-$(PLATFORM)

distclean::
	rm -rf $(PLATFORM) .installed-$(PLATFORM)