# $Id$ # aria2 Makefile # Copyright (c) 2007-2009, Ross Smith II (http://smithii.com). All Rights Reserved # http://internap.dl.sourceforge.net/sourceforge/aria2/aria2c-0.14.0+1.tar.bz2 ARIA2_VER ?=1.6.0 ARIA2_REV ?= ARIA2_DIR ?=aria2-${ARIA2_VER} ARIA2_BZ2 ?=${ARIA2_DIR}.tar.bz2 ARIA2_URL ?=http://voxel.dl.sourceforge.net/sourceforge/aria2/${ARIA2_BZ2} ARIA2_WIN32_PATCH1=aria2-1.4.0-mingw.patch ARIA2_WIN32_PATCH2=aria2-0.11.2-mingw-cross-compile.patch #ARIA2_WIN32_PATCH1=HttpResponseTest.patch #ARIA2_WIN32_PATCH2=CookieStorageAssertError.patch ARIA2_WIN32_ZIP=aria2-${ARIA2_VER}${ARIA2_REV}-win32-$(OSNAME).zip ARIA2_WIN32_PATCH1_URL=http://smithii.com/files/${ARIA2_WIN32_PATCH1} ARIA2_WIN32_PATCH2_URL=http://smithii.com/files/${ARIA2_WIN32_PATCH2} ARIA2_WIN32_PATCHES=${ARIA2_WIN32_PATCH1} OSNAME:=$(shell uname | perl -ne 'tr/A-Z/a-z/; /([a-z]+)/ && print $$1;') BUNZIP2?=bunzip2 GUNZIP?=gunzip MAKE?=make PATCH?=patch PERL?=perl STRIP?=strip --strip-all SVN?=svn SUDO?= TAR?=tar WGET?=wget -N SSL?=OPENSSL #SSL?=GNUTLS GNUTLS_HOME?=C:/Progra~1/GnuTLS-1.7.7 # libcrypto requires -lgdi32 # libcares requires -lws2_32 # libssl requires -lcrypto DLLS= CONFIGURE=./configure ifeq ('${SSL}', 'OPENSSL') CONFIGURE=CPPFLAGS="-I/usr/local/include" \ LDFLAGS="-L/usr/local/lib" \ LIBS="-lssl -lcrypto -lws2_32 -lgdi32 -lpthread -lsqlite3" \ ./configure \ --with-openssl \ --with-openssl-prefix=/usr/local \ --without-gnutls \ --without-daemon # --without-cppunit \ # --without-libares \ # --without-libcares \ # --without-libxml2 endif ifeq ('${SSL}', 'GNUTLS') CONFIGURE=CPPFLAGS="-I/usr/local/include" \ LDFLAGS="-L/usr/local/lib" \ LIBS="-lgnutls -lws2_32 -lpthread -lsqlite3" ./configure \ --with-gnutls \ --without-openssl ifeq ('$(OSNAME)', 'mingw') DLLS=\ ${GNUTLS_HOME}/bin/libgcrypt-11.dll \ ${GNUTLS_HOME}/bin/libgpg-error-0.dll \ ${GNUTLS_HOME}/bin/libgnutls-13.dll \ ${GNUTLS_HOME}/bin/libtasn1-3.dll endif endif ifeq ('${OSNAME}', 'linux') CONFIGURE=CPPFLAGS="-I/usr/i586-mingw32msvc/include" \ LDFLAGS="-L/usr/i586-mingw32msvc/lib" \ LIBS="-lssl -lcrypto -lws2_32 -lgdi32 -lpthread -lsqlite3" \ ./configure \ --prefix=/usr/i586-mingw32msvc \ --host=i586-mingw32msvc \ --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \ --with-cppunit-prefix=/usr/i586-mingw32msvc \ --with-libcares-prefix=/usr/i586-mingw32msvc \ --with-openssl-prefix=/usr/i586-mingw32msvc \ --with-xml-prefix=/usr/i586-mingw32msvc \ --with-xml-exec-prefix=/usr/i586-mingw32msvc \ --without-gnutls \ --without-libares \ --with-cppunit \ --with-libcares \ --with-libxml2 \ --with-openssl # --without-cppunit \ # --without-libares \ # --without-libcares \ # --without-libxml2 # CXX=i586-mingw32msvc-g++ MAKE=PATH=.:/usr/i586-mingw32msvc/bin:$$PATH \ make \ PREFIX=/usr/i586-mingw32msvc \ AR=i586-mingw32msvc-ar \ AS=i586-mingw32msvc-as \ CC=i586-mingw32msvc-gcc \ CXX=i586-mingw32msvc-g++ \ LD=i586-mingw32msvc-ld \ RC=i586-mingw32msvc-windres endif #ifeq ('$(OSNAME)', 'cygwin') # CONFIGURE_ENV?=LIBS="-lws2_32 -lpthread" #endif ARIA2_TAR_TOUCH=${ARIA2_DIR}/.tar.touch ARIA2_PATCH1_TOUCH=${ARIA2_DIR}/.patch1.touch ARIA2_PATCH2_TOUCH=${ARIA2_DIR}/.patch2.touch ARIA2_RECONF_TOUCH=${ARIA2_DIR}/.reconf.touch ARIA2_SVN_TOUCH=${ARIA2_DIR}/.svn.touch ARIA2_CONFIGURE_TOUCH=${ARIA2_DIR}/.configure-$(OSNAME).touch ARIA2_MAKE_TOUCH=${ARIA2_DIR}/.make-$(OSNAME).touch ARIA2_TEST_TOUCH=${ARIA2_DIR}/.test-$(OSNAME).touch ARIA2_STRIP_TOUCH=${ARIA2_DIR}/.strip-$(OSNAME).touch ARIA2_INSTALL_TOUCH=${ARIA2_DIR}/.install-$(OSNAME).touch all: make ${ARIA2_BZ2}: ${WGET} ${ARIA2_URL} wget: ${ARIA2_BZ2} ${ARIA2_TAR_TOUCH}: ${ARIA2_BZ2} ${TAR} xjvf $< touch $@ untar: ${ARIA2_TAR_TOUCH} ${ARIA2_WIN32_PATCH1}: ${WGET} ${ARIA2_WIN32_PATCH1_URL} ${ARIA2_PATCH1_TOUCH}: ${ARIA2_WIN32_PATCH1} ${ARIA2_TAR_TOUCH} #cd ${ARIA2_DIR} && \ # ${PATCH} -p0 <../$< touch $@ patch1: ${ARIA2_PATCH1_TOUCH} ${ARIA2_WIN32_PATCH2}: #${WGET} ${ARIA2_WIN32_PATCH2_URL} ${ARIA2_PATCH2_TOUCH}: ${ARIA2_WIN32_PATCH2} ${ARIA2_TAR_TOUCH} #cd ${ARIA2_DIR} && \ # ${PATCH} -p0 <../$< touch $@ patch3: ${ARIA2_PATCH3_TOUCH} ARIA2_PATCH_TOUCHES=${ARIA2_PATCH1_TOUCH} PATCHES=patch1 #ifeq ('${OSNAME}', 'linux') ARIA2_WIN32_PATCHES+=${ARIA2_WIN32_PATCH2} ARIA2_PATCH_TOUCHES+=${ARIA2_PATCH2_TOUCH} PATCHES+=patch3 #endif patch: ${PATCHES} ${ARIA2_RECONF_TOUCH}: ${ARIA2_PATCH_TOUCHES} cd ${ARIA2_DIR} && \ aclocal -I . -I m4 cd ${ARIA2_DIR} && \ autoheader cd ${ARIA2_DIR} && \ automake cd ${ARIA2_DIR} && \ autoconf touch $@ reconf: ${ARIA2_RECONF_TOUCH} ${ARIA2_SVN_TOUCH}: ${SVN} co http://aria2.svn.sourceforge.net/svnroot/aria2/trunk ${ARIA2_DIR} touch $@ touch ${ARIA2_BZ2} touch ${ARIA2_TAR_TOUCH} touch ${ARIA2_PATCH_TOUCHES} touch ${ARIA2_RECONF_TOUCH} svn: ${ARIA2_SVN_TOUCH} ${ARIA2_CONFIGURE_TOUCH}: ${ARIA2_PATCH_TOUCHES} -cd ${ARIA2_DIR} && \ test libxml2-2.dll || cp -p /usr/local/bin/libxml2-2.dll . cd ${ARIA2_DIR} && \ ${CONFIGURE} -touch ${ARIA2_DIR}/po/* cd ${ARIA2_DIR} && \ touch Makefile config.h intl/Makefile m4/Makefile po/Makefile src/Makefile test/Makefile doc/Makefile touch $@ configure: ${ARIA2_CONFIGURE_TOUCH} ${ARIA2_MAKE_TOUCH}: ${ARIA2_CONFIGURE_TOUCH} echo echo $$* >${ARIA2_DIR}/missing chmod a+x ${ARIA2_DIR}/missing -touch ${ARIA2_DIR}/po/* cd ${ARIA2_DIR} && \ ${MAKE} touch $@ make: ${ARIA2_MAKE_TOUCH} ${ARIA2_TEST_TOUCH}: ${ARIA2_MAKE_TOUCH} cd ${ARIA2_DIR}/test && \ ${MAKE} check touch $@ test: ${ARIA2_TEST_TOUCH} ${ARIA2_INSTALL_TOUCH}: ${ARIA2_MAKE_TOUCH} cd ${ARIA2_DIR} && \ ${SUDO} ${MAKE} install touch $@ install: ${ARIA2_INSTALL_TOUCH} # cd ${ARIA2_DIR}/test && \ # test -f aria2c.exe && \ # cp -p aria2c.exe aria2c-unittests-debug.exe # cd ${ARIA2_DIR}/test && \ # test -f aria2c.exe && \ # ${STRIP} -o aria2c-unittests.exe aria2c.exe ${ARIA2_STRIP_TOUCH}: ${ARIA2_MAKE_TOUCH} cd ${ARIA2_DIR}/src && \ cp -p aria2c.exe aria2c-debug.exe cd ${ARIA2_DIR}/src && \ ${STRIP} aria2c.exe touch $@ strip: ${ARIA2_STRIP_TOUCH} # test/aria2c-unittests.exe \ # test/*.netrc \ # test/*.torrent \ # test/*.txt \ # test/*.xml \ ${ARIA2_WIN32_ZIP}: strip rm -f $@ cd ${ARIA2_DIR} && \ PATH=/c/Progra~1/GnuWin32/bin:$$PATH \ zip -9j ../$@ \ src/aria2c.exe \ Changelog \ COPYING \ README \ ../aria2.readme/README-win32.txt \ ../aria2.mak \ ../c-ares.mak \ ../cppunit.mak \ ../libxml2.mak \ ../sqlite3.mak \ ../zlib.mak \ ../openssl-mingw.mak #for i in ${ARIA2_WIN32_PATCH1} ;\ #do \ # PATH=/c/Progra~1/GnuWin32/bin:$$PATH \ # zip -9j $@ $$i ;\ #done #for i in aria2*$(OSNAME)*.patch c-ares*$(OSNAME)*.patch cppunit*$(OSNAME)*.patch libxml*$(OSNAME)*.patch openssl*$(OSNAME)*.patch ;\ #do \ # zip -9j $@ $$i ;\ #done ifeq ('$(OSNAME)', 'mingw') cd ${ARIA2_DIR} && \ PATH=/c/Progra~1/GnuWin32/bin:$$PATH \ zip -9j ../$@ \ /usr/local/bin/libxml2-2.dll \ /usr/local/bin/libsqlite3-0.dll \ /mingw/bin/pthreadGC2.dll \ $(DLLS) endif ifeq ('$(OSNAME)', 'cygwin') cd ${ARIA2_DIR} && \ zip -j9 ../$@ \ `cygcheck src/aria2c.exe | grep -i \.dll | grep -i \\cyg | tr -d ' \r' | sort -u` endif dist: ${ARIA2_WIN32_ZIP} unconf: rm -f ${ARIA2_CONFIGURE_TOUCH} clean: unconf rm -fr \ ${ARIA2_MAKE_TOUCH} \ ${ARIA2_INSTALL_TOUCH} cd ${ARIA2_DIR} && \ ${MAKE} clean rmdir: rm -fr ${ARIA2_DIR} nuke: rmdir rm -f ${ARIA2_BZ2} diff: diff -uwrN ${ARIA2_DIR}.orig ${ARIA2_DIR} >${ARIA2_DIR}-mingw.patch.diff diff_files: grep ^diff ${ARIA2_WIN32_PATCH} | cut -d / -f 2-3 | cut -d ' ' -f 1 | sort #upload: ${ARIA2_WIN32_ZIP} upload: #echo binary >aria2.ftp #echo hash >>aria2.ftp #echo passive >>aria2.ftp echo cd uploads >aria2.ftp echo put aria2-${ARIA2_VER}${ARIA2_REV}-win32-mingw.zip >>aria2.ftp echo exit >>aria2.ftp PATH=/c/cygwin/bin:$$PATH sftp -b aria2.ftp rossta@frs.sourceforge.net .PHONY: all clean configure diff diff_files dist install make nuke patch1 patch3 patch reconf rmdir strip svn test unconf untar upload wget