Changeset 56
- Timestamp:
- 12/17/05 07:35:41 (3 years ago)
- Files:
-
- bpkg/trunk/bpkg (modified) (11 diffs)
- bpkg/trunk/Makefile (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
bpkg/trunk/bpkg
r54 r56 33 33 # Where to store built packages 34 34 PKGDIR=$PWD 35 # Skip configurephase by default?36 SKIP CONFIGURE=035 # Skip build phase by default? 36 SKIPBUILD=0 37 37 # Program used to download source 38 38 DOWNLOADER='wget -c' … … 47 47 # Load system config 48 48 test -r /etc/bpkg.conf && . /etc/bpkg.conf 49 # Load per-user config 50 test -r ~/.bpkgrc && . ~/.bpkgrc 49 51 50 52 # 51 53 # XXXXXXXXXXXXXX Not really user-modifiable below here XXXXXXXXXXXXX 52 54 # 53 VERSION="0. 4"55 VERSION="0.5" 54 56 PACKAGER=auto 55 57 SELF=`basename $0` … … 63 65 DESTROOT=/tmp/$SELF.$PACKAGE.$$.pkg 64 66 TMPFILES="$TMPDIR $DESTROOT $INSTALLLOG" 65 MAKEINSTALL='make install' 67 BUILDER=auto 68 INSTALLER='make install' 69 CUSTOMBUILDER='' 66 70 EXPLICIT_PACKAGE=0 67 71 REQUIRED_PROGRAMS='installwatch cpio perl tar bzip2 unzip gzip' … … 135 139 export INSTALLWATCH_BACKUP_PATH=$SRCDIR/backup-`date +%Y%m%d%H%M%S-backup` 136 140 fi 137 installwatch -o $INSTALLLOG $ MAKEINSTALL|| error "package installation failed"141 installwatch -o $INSTALLLOG $INSTALLER || error "package installation failed" 138 142 if [ $BACKUP = 1 -a -d $INSTALLWATCH_BACKUP_PATH ]; then 139 143 notice "Archiving backup to $INSTALLWATCH_BACKUP_PATH.tar.gz" … … 152 156 } 153 157 158 # Builders 159 build_xmkmf() 160 { 161 notice "running xmkmf on Imakefile" 162 xmkmf || error "xmkmf failed" 163 } 164 165 build_autoconf() 166 { 167 if ! grep -i autoconf ./configure > /dev/null; then 168 notice "./configure does not seem to be generated by autoconf, running anyway" 169 fi 170 notice "running './configure --prefix=$PREFIX --sysconfdir=$SYSCONFDIR --localstatedir=$LOCALSTATEDIR --datadir=$DATADIR $@'" 171 ./configure --prefix=$PREFIX --sysconfdir=$SYSCONFDIR --localstatedir=$LOCALSTATEDIR --datadir=$DATADIR "$@" || error "configure failed" 172 make 173 } 174 175 build_autogen() 176 { 177 notice "no ./configure, but we have ./autogen.sh - running it" 178 ./autogen.sh --prefix=$PREFIX --sysconfdir=$SYSCONFDIR --localstatedir=$LOCALSTATEDIR --datadir=$DATADIR "$@" || error "./autogen.sh failed" 179 if test ! -r Makefile; then 180 notice "./autogen.sh did not run configure, running it now" 181 build_autoconf 182 fi 183 make 184 } 185 186 build_make() 187 { 188 notice "source doesn't appear to use autoconf or Imake, trying standard make" 189 test -r $MAKEFILE || MF=makefile 190 test -r $MAKEFILE || MF=GNUmakefile 191 test -r $MAKEFILE || error "can't determine makefile (tried Makefile, makefile and GNUmakefile)" 192 # Change /usr/local to $PREFIX 193 if grep /usr/local $MAKEFILE > /dev/null; then 194 notice "Changing all instances of /usr/local in $MAKEFILE to $PREFIX" 195 sed -e "s,/usr/local,$PREFIX,g" $MAKEFILE > $MAKEFILE~ && mv $MAKEFILE~ $MAKEFILE 196 fi 197 make 198 } 199 200 build_jam() 201 { 202 jam 203 } 204 205 build_python() 206 { 207 python setup.py build -f 208 } 209 210 build_perl() 211 { 212 perl Makefile.PL || error "Makefile generation failed" 213 make 214 } 215 216 build_qmake() 217 { 218 qmake $PACKAGE.pro || error "qmake failed" 219 make 220 } 221 222 build_custom() 223 { 224 eval "$CUSTOMBUILDER" || error "custom builder failed" 225 } 226 227 # Packagers 154 228 packager_slackware() 155 229 { … … 302 376 quitloop=0 303 377 while [ $quitloop = 0 -a $# != 0 ]; do 304 # if [[ "$1" = cpan://* ]]; then305 # CPAN="${1#cpan://}"306 # PACKAGE=perl-`echo ${CPAN/::/-} | tr A-Z a-z`307 # notice "Pre-installing Perl module before packaging"308 # perl -MCPAN -e "install '$CPAN'" || error "CPAN install failed"309 # PACKAGEVER=`perl -MExtUtils::Installed -e "print ExtUtils::Installed->new()->version('$CPAN')" 2> /dev/null`310 # CPANTMP="/tmp/$SELF.$PACKAGE.$$.cpan"311 # TMPFILES="$TMPFILES $CPANTMP"312 # mkdir -p $CPANTMP313 # cd "$CPANTMP"314 # SRCDIR=$PWD315 # test -z "$PACKAGEVER" && error "could not determine version of Perl module $CPAN"316 # perl -MExtUtils::Installed -e "print join(\"\n\", ExtUtils::Installed->new()->files('$CPAN')) . \"\n\"" | duplicate_paths "$CPANTMP" || error "failed to extract PERL module content list"317 # cat <<EOF > Makefile318 #all:319 #320 #install:321 # find ./ | cpio -pdm /322 # rm -f /Makefile323 #EOF324 # notice "packaging perl module $CPAN as $PACKAGE-$PACKAGEVER"325 378 if [[ -f "$1" || "$1" = ftp://* || "$1" = http://* ]]; then 326 379 AUTOEXTRACT="$1" … … 396 449 Display the O/S that bpkg thinks you are running. 397 450 --version 398 Show $SELF version. 399 --skip-configure 400 Do not perform the configure phase of bpkg. Useful for already configured 401 source. 451 Show bpkg version. 402 452 --packager=arch|slackware|rpm|deb|gentoo|redhat|suse|auto 403 453 Generate packages using the specified packaging system. 'auto' is the … … 412 462 --localstatedir=/var/state/<package> and --datadir=/usr/share/<package>). 413 463 The base directories are used if this option is not given. 464 --skip-build 465 Do not perform the build phase of bpkg. 466 --build-with=<command> 467 Use the given command to build, rather than the default 'make'. 414 468 --install-with=<command> 415 Use the given command to install rather than the default 'make install'.469 Use the given command to install, rather than the default 'make install'. 416 470 --md5=<md5sum> 417 471 Verify that the source file has the given MD5 checksum. … … 421 475 exit 0 422 476 ;; 423 --install-with=*) 424 MAKEINSTALL=`echo "$1" | cut -d= -f2-` 425 ;; 426 --skip-configure) 427 SKIPCONFIGURE=1 477 --install-with=*) 478 INSTALLER=`echo "$1" | cut -d= -f2-` 479 ;; 480 --build-with=*) 481 CUSTOMBUILDER=`echo "$1" | cut -d= -f2-` 482 BUILDER=custom 483 ;; 484 --skip-build) 485 SKIPBUILD=1 428 486 ;; 429 487 --prefix=*) … … 480 538 fi 481 539 482 if [ $ SKIPCONFIGURE = 0]; then540 if [ $BUILDER = auto ]; then 483 541 if [ -x ./configure ]; then 484 if ! grep -i autoconf ./configure > /dev/null; then 485 notice "./configure does not seem to be generated by autoconf, running anyway" 486 fi 487 notice "running './configure --prefix=$PREFIX --sysconfdir=$SYSCONFDIR --localstatedir=$LOCALSTATEDIR --datadir=$DATADIR $@'" 488 ./configure --prefix=$PREFIX --sysconfdir=$SYSCONFDIR --localstatedir=$LOCALSTATEDIR --datadir=$DATADIR "$@" || error "configure failed" 542 BUILDER=autoconf 489 543 elif [ -x autogen.sh ]; then 490 notice "no ./configure, but we have ./autogen.sh - running it" 491 ./autogen.sh --prefix=$PREFIX --sysconfdir=$SYSCONFDIR --localstatedir=$LOCALSTATEDIR --datadir=$DATADIR "$@" || error "./autogen.sh failed" 492 if test ! -r Makefile; then 493 notice "./autogen.sh did not run configure, running" 494 ./configure --prefix=$PREFIX --sysconfdir=$SYSCONFDIR --localstatedir=$LOCALSTATEDIR --datadir=$DATADIR "$@" || error "configure failed" 495 fi 544 BUILDER=autogen 496 545 elif [ -r Imakefile ]; then 497 notice "running xmkmf on Imakefile" 498 xmkmf || error "xmkmf failed" 546 BUILDER=xmkmf 499 547 elif [ -r GNUmakefile -o -r makefile -o -r Makefile ]; then 500 notice "source doesn't appear to use autoconf or Imake, trying standard make" 501 test -r $MAKEFILE || MF=makefile 502 test -r $MAKEFILE || MF=GNUmakefile 503 test -r $MAKEFILE || error "can't determine makefile (tried Makefile, makefile and GNUmakefile)" 504 # Change /usr/local to $PREFIX 505 if grep /usr/local $MAKEFILE > /dev/null; then 506 notice "changing all instances of /usr/local in $MAKEFILE to /usr" 507 sed -e "s,/usr/local,$PREFIX,g" $MAKEFILE > $MAKEFILE~ && mv $MAKEFILE~ $MAKEFILE 508 fi 548 BUILDER=make 509 549 elif [ -r Jamfile ]; then 510 which jam > /dev/null 2>&1 || error "found Jamfile, but didn't find jam" 511 notice "generating stub Makefile for jam" 512 cat << EOF > Makefile 513 build: 514 jam 515 516 install: 517 jam install 518 EOF 550 BUILDER=jam 551 INSTALLER='jam install' 519 552 elif [ -r setup.py ]; then 520 which python > /dev/null 2>&1 || error "found setup.py, but didn't find python" 521 notice "generating stub Makefile for python" 522 cat <<EOF > Makefile 523 build: 524 python setup.py build -f 525 526 install: 527 python setup.py install -f 528 EOF 553 BUILDER=python 554 INSTALLER='python setup.py install -f' 529 555 elif [ -r Makefile.PL ]; then 530 perl Makefile.PL556 BUILDER=perl 531 557 elif [ -r $PACKAGE.pro ]; then 532 qmake $PACKAGE.pro || error "qmake failed"558 BUILDER=qmake 533 559 else 534 560 error "couldn't auto-detect build mechanism" … … 536 562 fi 537 563 538 make || error "'make failed'" 564 if [ $SKIPBUILD = 0 ]; then 565 eval build_$BUILDER || error "build failed" 566 fi 539 567 540 568 eval packager_$PACKAGER bpkg/trunk/Makefile
r48 r56 5 5 OS=$(shell ./bpkg --detect-os) 6 6 7 .PHONY: $(OS)-build $(OS)- install7 .PHONY: $(OS)-build $(OS)-pre-install $(OS)-install real-install all install 8 8 9 9 all: $(OS)-build 10 10 11 install: 11 install: all $(OS)-pre-install 12 12 @if ! ./bpkg --install-with='make install-raw' --package=bpkg-`./bpkg --version`; then \ 13 13 echo; \ … … 20 20 exit 1; \ 21 21 fi 22 @cat README 22 23 23 24 install-raw: all $(OS)-install 24 25 mkdir -p $(DESTDIR)$(PREFIX)/bin 25 26 install -m755 bpkg $(DESTDIR)$(PREFIX)/bin 26 @cat README27 27 28 28 $(INSTALLWATCH): $(INSTALLWATCH).tgz … … 46 46 @exit 1 47 47 48 arch-install:49 @echo 50 @echo " Run 'pacman -S installwatch' to install installwatch."51 @e cho48 unknown-install: 49 @echo "FATAL: Unknown operating system/distribution. Need detection and" 50 @echo " backend code in bpkg." 51 @exit 1 52 52 53 install-installwatch: 54 $(MAKE) -C $(INSTALLWATCH) PREFIX=$(PREFIX) BINDIR=$(DESTDIR)$(PREFIX)/bin LIBDIR=$(DESTDIR)$(PREFIX)/lib install 55 56 # Arch 57 arch-pre-install: 58 @if ! pacman -Q installwatch > /dev/null 2>&1; then \ 59 echo "Installwatch is required by bpkg, attempting to install"; \ 60 pacman -S installwatch; \ 61 pacman -Q installwatch > /dev/null 2>&1 || exit 1; \ 62 fi 63 64 # Gentoo 53 65 gentoo-build: $(INSTALLWATCH) 54 66 $(MAKE) -C $(INSTALLWATCH) PREFIX=/usr 55 67 56 gentoo-install: 57 $(MAKE) -C $(INSTALLWATCH) PREFIX=$(PREFIX) BINDIR=$(DESTDIR)$(PREFIX)/bin LIBDIR=$(DESTDIR)$(PREFIX)/lib install 68 gentoo-pre-install: install-installwatch 58 69 70 gentoo-install: gentoo-pre-install 71 72 # Slackware 59 73 slackware-build: 60 74 @if ! ls /var/log/packages/checkinstall* > /dev/null 2>&1; then \ … … 68 82 fi 69 83 70 slackware-install: 71 @ls /var/log/packages/checkinstall* > /dev/null 2>&1 || $(MAKE) -C $(INSTALLWATCH) PREFIX=$(PREFIX) BINDIR=$(DESTDIR)$(PREFIX)/bin LIBDIR=$(DESTDIR)$(PREFIX)/lib install 84 slackware-pre-install: 85 @ls /var/log/packages/checkinstall* > /dev/null 2>&1 || $(MAKE) install-installwatch 86 87 slackware-install: slackware-pre-install
