[arch-general] makepkg is creating BOTH a /pkg and pkgusr on build??

David C. Rankin drankinatty at suddenlinkmail.com
Fri May 18 09:44:46 EDT 2012


On 05/18/2012 08:04 AM, Dennis Herbrich wrote:
> On Fri, May 18, 2012 at 07:54:27AM -0500, David C. Rankin wrote:
>> OK, I'll check again for the package manipulating pkgdir, because I'm using
>> the standard package:
>>
>> package() {
>>   msg "Packaging ${pkgname}-${pkgver}"
>>
>>   cd ${pkgname}-${pkgver}
>>
>>   make DESTDIR=$pkgdir install
>> }
> 
> Interestingly enough, my /usr/share/pacman/PKGBUILD.proto thinks otherwise:
>   [...]
>   package() {
>     cd "$srcdir/$pkgname-$pkgver"
>     make DESTDIR="$pkgdir/" install
>   }
>   [...]
> 
> And besides the unquoted DESTDIR leading to trouble, the additional slash would also explain and likely fix your issue.
> 
> I'd suggest using a matching .proto file whenever creating a new package
> instead of copying an old PKGBUILD. They are updated every now and then, and
> you should profit from this.
> 
> Best regards.
>   Dennis
> 

Allan, Dennis, thanks.

  I will check for a matching .proto file with new packages. I don't know if
that would have helped here. The issue was in the Makefile:

src/gebc-1.07/Makefile:am__installdirs = "$(DESTDIR)$(bindir)"
src/gebc-1.07/Makefile:   echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
src/gebc-1.07/Makefile:   $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \

  I had tried both

  make DESTDIR=$pkgdir install

and

  make DESTDIR="$pkgdir/" install

  Which didn't make any difference -- that surprised me. I finally just ran a
sed script on the Makefile testing with makepkg -R and the following is what
allowed it to package properly:

  find . -name "Makefile*" -exec sed -i
'/$(DESTDIR)$(bindir)/s|$(DESTDIR)$(bindir)|$(DESTDIR)/$(bindir)|g' '{}' \;
  find . -name "Makefile*" -exec sed -i
'/$(DESTDIR)$(libdir)/s|$(DESTDIR)$(libdir)|$(DESTDIR)/$(libdir)|g' '{}' \;

Makefile:am__installdirs = "$(DESTDIR)/$(bindir)"
Makefile:         echo " $(MKDIR_P) '$(DESTDIR)/$(bindir)'"; \
Makefile:         $(MKDIR_P) "$(DESTDIR)/$(bindir)" || exit 1; \

  But for some reason, placing the find/sed calls after ./configure in the
PKGBUILD didn't execute the sed calls in the same way as executing them manually
in ${srcdir}/${pkgname}-${pkgver} from within the PKGBUILD.

  The PKGBUILD I attempted to use was the following:

pkgname=gebc
pkgver=1.07
pkgrel=1
arch=(i686 x86_64)
pkgdesc="GNU External Ballistic Calculator with ballistic and target plotting."
url="https://sourceforge.net/projects/balcomp/?source=directory"
license="GPL"
depends=('fltk' 'libharu')
groups=()
makedepends=('automake' 'autoconf' 'libtool' 'gcc')
conflicts=()
provides=("${pkgname}-${pkgver}")
replaces=()
source=("https://downloads.sourceforge.net/project/balcomp/GNU Ballistics -
Source/Version 1.07/${pkgname}-${pkgver}-src.tar.gz"
        'gebc.diff'
        'gebc-fl_draw.diff')
md5sums=('6d284172ac0a665d03d7cdbcf4194bfe'
         '659fd7a4640fc2361273f5ec8437eea5'
         '02f8f35bb6e544818655af019b3ae0db')

build() {

  cd ${srcdir}
  ## Patching with V2 patch from Mike Nix as SourceForge
  msg "Patching to update to V2........."
  patch -Np0 -i gebc.diff

  msg "Patching fl_draw.h -> H........."
  patch -Np0 -i gebc-fl_draw.diff

  msg "Running autoreconf ...."
  cd ${srcdir}/${pkgname}-${pkgver}
  autoreconf

  ## configure
  msg "Configuring - ${pkgname}..."
  ./configure --prefix=/usr

  find . -name "Makefile*" -exec sed -i
'/$(DESTDIR)$(bindir)/s|$(DESTDIR)$(bindir)|$(DESTDIR)/$(bindir)|g' '{}' \;
  find . -name "Makefile*" -exec sed -i
'/$(DESTDIR)$(libdir)/s|$(DESTDIR)$(libdir)|$(DESTDIR)/$(libdir)|g' '{}' \;

  make
}

package() {
  msg "Packaging ${pkgname}-${pkgver}"

  cd ${pkgname}-${pkgver}

  make -j1 DESTDIR="${pkgdir}/" install
}

  If you see anything wrong, or a better way to do something, please let me
know. If you want to take a quick look at what is going on, I've put the source
and packages on my site for your convenience [about 200k in all]:

http://www.3111skyline.com/dl/arch/pkg/src/gebc-1.07-src.tar.gz
http://www.3111skyline.com/dl/arch/pkg/src/gebc.diff
http://www.3111skyline.com/dl/arch/pkg/src/gebc-fl_draw.diff


-- 
David C. Rankin, J.D.,P.E.


More information about the arch-general mailing list