Ver código fonte

Added build_osx_release.sh, which builds OSX universal binary DMG.

Tatsuhiro Tsujikawa 13 anos atrás
pai
commit
4d510b3032
2 arquivos alterados com 61 adições e 0 exclusões
  1. 3 0
      README.asciidoc
  2. 58 0
      build_osx_release.sh

+ 3 - 0
README.asciidoc

@@ -172,6 +172,9 @@ necessary to build the program:
 $ autoreconf -i
 ---------------
 
+If you are building aria2 for Mac OS X, take a look at
+build_osx_release.sh, which builds OSX universal binary DMG.
+
 The quickest way to build aria2 is just type following commands:
 
 -------------

+ 58 - 0
build_osx_release.sh

@@ -0,0 +1,58 @@
+#!/bin/bash
+
+# Generate an OSX universal binary (32+64b intel) DMG with Installer & DMG
+#
+# This script is supposed to be run from the aria2 source directory.
+# It has to be run on an OSX 10.6 host with Developer Tools installed.
+#
+# Additionally, Macports must be installed with the following packages:
+#
+# autoconf autoconf213 autogen +universal automake coreutils +universal
+# expat +universal gettext +universal gmake +universal gnutls +universal
+# icu +universal libgcrypt +universal libxml2 +universal m4 +universal
+# openssl +universal pkgconfig +universal
+#
+# Author: renaud gaudin
+
+# path definitions.
+A2_VERSION=`cat config.h |grep "define VERSION" | cut -f 2 -d '"' -`
+CURRENT_DIR=`pwd`
+PACKAGE_ROOT=${CURRENT_DIR}/aria_build
+BUILD_TARGET=${PACKAGE_ROOT}/usr
+PACKAGE_RESOURCES=${CURRENT_DIR}/osx_resources
+TARGET_NAME=aria2-${A2_VERSION}
+PKG_NAME=${TARGET_NAME}.pkg
+DMG_NAME=${TARGET_NAME}.dmg
+UNINST_NAME="Uninstall aria2.applescript"
+DMG_SKEL=aria2_dmg
+
+# build aria2 mostly static
+mkdir -p $BUILD_TARGET
+export LIBS="-lcrypto -lz -lpthread -ldl"
+export LDFLAGS="-static-libstdc++"
+CC="gcc -arch i386 -arch x86_64" CXX="g++ -arch i386 -arch x86_64" CPP="gcc -E" CXXCPP="g++ -E" ./configure --without-libxml2 --without-gnutls --with-libexpat --with-openssl --prefix=$BUILD_TARGET
+make
+
+# install into our target
+make install
+
+# create pkg installer
+mkdir -p ${PACKAGE_RESOURCES}
+cp -av README.html ${PACKAGE_RESOURCES}/Welcome.html
+cp -av COPYING ${PACKAGE_RESOURCES}/License.txt
+cp -av NEWS ${PACKAGE_RESOURCES}/ReadMe.txt
+
+rm -rf ${PKG_NAME}
+/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker --root ${PACKAGE_ROOT} --id aria2 --version ${A2_VERSION} --title "aria2" --domain system --resources ${PACKAGE_RESOURCES} --out ${PKG_NAME}
+
+# create uninstaller tool
+DEL_STR=`find ${PACKAGE_ROOT}/ -type f | sed -e "s,$PACKAGE_ROOT,sudo rm -f ," | tr '\n' ' ; '`
+echo "(do shell script \"mkdir -p /var/db/sudo/$USER; touch /var/db/sudo/$USER\" with administrator privileges) & (do shell script \"${DEL_STR}\")" > "$UNINST_NAME"
+
+# create dmg with installer and uninstall inside
+rm -rf ${DMG_SKEL}
+mkdir -p ${DMG_SKEL}
+cp -av ${PKG_NAME} ${DMG_SKEL}/
+cp -av "${UNINST_NAME}" ${DMG_SKEL}/
+rm -f ${DMG_NAME}
+hdiutil create -megabytes 20 -fs HFS+ -volname aria2 -nospotlight -srcfolder ${DMG_SKEL} ${DMG_NAME}