Started to switch to a Makefile-based build system (still very incomplete,

so the Jamfile are still there).
Set a few svn:ignore properties.
This commit is contained in:
Eric Petit 2006-03-07 20:23:40 +00:00
parent eba49d3d2a
commit bf7ce0a305
6 changed files with 292 additions and 0 deletions

10
.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
/.depend
/Makefile.config
libtransmission/*.a
libtransmission/.depend
macosx/English.lproj/*~.nib
macosx/Info.plist
macosx/Transmission.xcodeproj/*.mode1
macosx/Transmission.xcodeproj/*.pbxuser
macosx/build
/transmissioncli

57
Makefile Normal file
View File

@ -0,0 +1,57 @@
include Makefile.config
include Makefile.common
SRCS = transmissioncli.c
OBJS = $(SRCS:%.c=%.o)
CFLAGS += -Ilibtransmission
all: transmissioncli
ifeq ($(SYSTEM),Darwin)
$(MAKE) -C macosx
endif
transmissioncli: lib $(OBJS)
$(CC) -o $@ $(OBJS) libtransmission/libtransmission.a $(LDFLAGS)
lib:
$(MAKE) -C libtransmission
%.o: %.c Makefile.config Makefile.common Makefile
$(CC) $(CFLAGS) -o $@ -c $<
package-macosx:
$(RM) tmp "Transmission $(VERSION_STRING)" \
Transmission-$(VERSION_STRING).dmg && \
mkdir -p tmp/Transmission.app && \
ditto macosx/build/Debug/Transmission.app tmp/Transmission.app && \
ditto AUTHORS tmp/AUTHORS.txt && \
ditto LICENSE tmp/LICENSE.txt && \
ditto NEWS tmp/NEWS.txt && \
strip -S tmp/Transmission.app/Contents/MacOS/Transmission && \
( echo "[InternetShortcut]"; \
echo "URL=http://transmission.m0k.org/" ) > \
tmp/Homepage.url && \
( echo "[InternetShortcut]"; \
echo "URL=http://transmission.m0k.org/forum/" ) > \
tmp/Forums.url && \
( echo "[InternetShortcut]"; \
echo "URL=http://transmission.m0k.org/contribute.php" ) > \
tmp/Contribute.url && \
mv tmp "Transmission $(VERSION_STRING)" && \
hdiutil create -format UDZO -srcfolder \
"Transmission $(VERSION_STRING)" Transmission-$(VERSION_STRING).dmg && \
rm -rf "Transmission $(VERSION_STRING)"
clean:
$(RM) transmissioncli $(OBJS)
$(MAKE) -C libtransmission clean
ifeq ($(SYSTEM),Darwin)
$(MAKE) -C macosx clean
endif
.depend: $(SRCS) Makefile
$(RM) .depend
$(foreach SRC, $(SRCS), $(CC) -MM -Ilibtransmission $(SRC) >> .depend;)
include .depend

40
Makefile.common Normal file
View File

@ -0,0 +1,40 @@
VERSION_MAJOR = 0
VERSION_MINOR = 5
VERSION_STRING = 0.6-svn
RM = rm -Rf
CFLAGS += -g -Wall -W -O3 -funroll-loops
CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
CFLAGS += -DVERSION_MAJOR=$(VERSION_MAJOR)
CFLAGS += -DVERSION_MINOR=$(VERSION_MINOR)
CFLAGS += -DVERSION_STRING=\"$(VERSION_STRING)\"
CFLAGS += -DSYS_$(shell echo $(SYSTEM) | dd conv=ucase 2>/dev/null)
ifeq ($(SYSTEM),BeOS)
ifeq ($(BEOS_NETSERVER),yes)
CFLAGS += -DBEOS_NETSERVER
LDFLAGS += -lnet
else
LDFLAGS += -lbind -lsocket
endif
endif
ifeq ($(SYSTEM),Darwin)
CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386
endif
ifeq ($(MATH),yes)
LDFLAGS += -lm
endif
ifeq ($(PTHREAD),yes)
ifeq ($(SYSTEM),FreeBSD)
LDFLAGS += -pthread
else
LDFLAGS += -lpthread
endif
endif
ifeq ($(OPENSSL),yes)
CFLAGS += -DHAVE_OPENSSL
LDFLAGS += -lcrypto
endif

147
configure.make Executable file
View File

@ -0,0 +1,147 @@
#! /bin/sh
#
# Default settings
#
SYSTEM=
BEOS_NETSERVER=no
MATH=no
PTHREAD=no
OPENSSL=
CC="${CC-cc}"
CFLAGS="${CFLAGS}"
LDFLAGS="${LDFLAGS}"
#
# Functions
#
usage()
{
cat << EOF
Options:
--disable-openssl Disable OpenSSL, use built-in SHA1 implementation
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags
EOF
}
openssl_test()
{
cat > testconf.c << EOF
#include <stdio.h>
#include <openssl/sha.h>
int main()
{
SHA1( 0, 0, 0 );
}
EOF
if $CC $CFLAGS $LDFLAGS -o testconf testconf.c -lcrypto > /dev/null 2>&1
then
echo "yes"
OPENSSL=yes
else
echo "missing, using built-in SHA1 implementation"
OPENSSL=no
fi
rm -f testconf.c testconf
}
#
# Parse options
#
while [ $# -ne 0 ]; do
param=`expr "opt$1" : 'opt[^=]*=\(.*\)'`
case "x$1" in
x--disable-openssl)
OPENSSL=no
;;
x--help)
usage
exit 0
;;
esac
shift
done
#
# System-specific flags
#
SYSTEM=`uname -s`
case $SYSTEM in
BeOS)
RELEASE=`uname -r`
case $RELEASE in
6.0*|5.0.4) # Zeta or R5 / BONE beta 7
;;
5.0*) # R5 / net_server
BEOS_NETSERVER=yes
;;
*)
echo "Unsupported BeOS version"
exit 1
;;
esac
;;
Darwin)
# Make sure the Universal SDK is installed
if [ ! -d /Developer/SDKs/MacOSX10.4u.sdk ]; then
cat << EOF
You need to install the Universal SDK in order to build Transmission:
Get your Xcode CD or package
Restart the install
When it gets to "Installation Type", select "Customize"
Select "Mac OS X 10.4 (Universal) SDL" under "Cross Development"
Finish the install.
EOF
exit 1
fi
PTHREAD=yes
;;
FreeBSD|NetBSD|OpenBSD|Linux)
MATH=yes
PTHREAD=yes
;;
*)
echo "Unsupported operating system"
exit 1 ;;
esac
echo "System: $SYSTEM"
#
# OpenSSL settings
#
echo -n "OpenSSL: "
if [ "$OPENSSL" = no ]; then
echo "disabled, using built-in SHA1 implementation"
else
openssl_test
fi
#
# Generate Makefile.config
#
rm -f Makefile.config
cat > Makefile.config << EOF
SYSTEM = $SYSTEM
BEOS_NETSERVER = $BEOS_NETSERVER
MATH = $MATH
PTHREAD = $PTHREAD
OPENSSL = $OPENSSL
CC = $CC
CFLAGS = $CFLAGS
LDFLAGS = $LDFLAGS
EOF
echo
echo "To build Transmission, run 'make'."

24
libtransmission/Makefile Normal file
View File

@ -0,0 +1,24 @@
include ../Makefile.config
include ../Makefile.common
SRCS = transmission.c bencode.c net.c tracker.c peer.c inout.c \
metainfo.c sha1.c utils.c fdlimit.c clients.c completion.c \
platform.c ratecontrol.c choking.c
OBJS = $(SRCS:%.c=%.o)
CFLAGS += -D__TRANSMISSION__
libtransmission.a: $(OBJS)
libtool -static $(OBJS) -o $@
%.o: %.c ../Makefile.config ../Makefile.common Makefile
$(CC) $(CFLAGS) -o $@ -c $<
clean:
$(RM) libtransmission.a $(OBJS)
.depend: $(SRCS) Makefile
$(RM) .depend
$(foreach SRC, $(SRCS), $(CC) -MM $(SRC) -D__TRANSMISSION__ >> .depend;)
include .depend

14
macosx/Makefile Normal file
View File

@ -0,0 +1,14 @@
include ../Makefile.config
include ../Makefile.common
SRCS = $(shell ls *.m *.h *.plist)
Transmission.app: $(SRCS) Info.plist
xcodebuild -configuration Debug | grep -v "^$$"
Info.plist: Info.plist.in ../Makefile.common
$(RM) $@
sed "s/%%VERSION%%/$(VERSION_STRING)/g" < $< > $@
clean:
$(RM) Info.plist build