Why you have to install a port to create a package (was Re: port to package amd64 to i386)

2012-03-07 Thread Matthew Seaman
On 07/03/2012 01:39, Da Rock wrote:
 On 03/07/12 04:13, Adam Vande More wrote:
 On Tue, Mar 6, 2012 at 11:36 AM, Bernt Hanssonb...@bananmonarki.se 
 wrote:

 Again, a problem is that packages can only be generated

 if the port has been installed

 Why is that. I hope you can educate me on that.

 Because a package is the result of what is installed.  It
 essentially works somewhat like Debian's checkinstall by keeping
 track of what's installed by the installation script, then using
 the info of what's installed to build the package.  I'm not exactly
 sure how make package works internally, but it wouldn't surprise
 me if it's almost the same as pkg_create -b.

 From what I understand of ports (as a maintainer) that is the case; plus
 some other bits and pieces for checking, verification, and cleanup.

DaRock has the essentials of how it works correct.  When a port is
installed, the first step is to install the software, typically using
the standard install target from upstream, although it's not unusual for
the port to just copy files into place itself[*].

That miscellaneous collection of files is then turned into a package by
collecting the data on file names and checksums in the packing list, the
package comment, any install messages or install/deinstall scripts into
the package directory /var/db/pkg/pkgname-0.99 If you're interested,
this stage is dealt with by the 'fake-pkg' target in bsd.ports.mk

[[pkgng works almost identically, except the data is stored in a sqlite
DB rather than separate directories in the filesystem.]]

Note that technically, a package is that combination of the collection
of files and the metadata about those files in the package registry.  A
package can be in two different states: installed, with the files spread
around the directory tree or as a tarball -- for the original pkg
format,  /var/db/pkgname-0.99 and all the files owned by the package;
for pkgng, the metadata is held as a YAML file.  pkg_add(1) converts
from the tarball to the installed state, 'pkg_create -b' goes in the
other direction.  The difference between 'make install' and 'make
package' in the ports is simply the addition of a final pkg_create
step.

Now, there is no a priori reason why all of this has to be done using
the live /usr/local directory tree on your system.  OpenBSD ports has
entirely switched to using a chroot for building package tarballs, and
in fact the FreeBSD package build cluster and Tinderbox basically work
that way already.  The procedure is to install all of the required
{FETCH,PATCH,BUILD,RUN,PKG} dependencies into a chroot filesystem (from
previously built package tarballs), install the port into the same
chroot and generate a package tarball from it.

There are advantages and disadvantages either way.  Building in a chroot
requires a lot more copying files around and general faff.  On the other
hand; it makes it easier to build as a non-privileged user, it makes
cross-building for different architectures feasible and it completely
avoids problems to do with software arbitrarily deciding to link against
random shared libraries it finds around the system -- or indeed to
accidentally use header files from a completely different piece of
software.  Converting ports to build in a chroot is one of those ideas
that is constantly bubbling up, but that never quite seems to get
implemented.

Cheers,

Matthew

[*] For completeness, the 'port' is the collection of instructions for
downloading the sources, patching, building and installing the software,
managing the dependency hierarchy required to do all that and dealing
with tracking all those files by creating the package metadata.
Although it is common to speak of 'installing a port' in fact what gets
installed is a package, and it is the port that does the installing.

-- 
Dr Matthew J Seaman MA, D.Phil.   7 Priory Courtyard
  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate
JID: matt...@infracaninophile.co.uk   Kent, CT11 9PW



signature.asc
Description: OpenPGP digital signature


Re: port to package amd64 to i386

2012-03-06 Thread Adam Vande More
On Tue, Mar 6, 2012 at 11:36 AM, Bernt Hansson b...@bananmonarki.se wrote:

 Again, a problem is that packages can only be generated
 if the port has been installed


 Why is that. I hope you can educate me on that.


Because a package is the result of what is installed.  It essentially works
somewhat like Debian's checkinstall by keeping track of what's installed by
the installation script, then using the info of what's installed to build
the package.  I'm not exactly sure how make package works internally, but
it wouldn't surprise me if it's almost the same as pkg_create -b.


-- 
Adam Vande More
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: port to package amd64 to i386

2012-03-06 Thread Da Rock

On 03/07/12 04:13, Adam Vande More wrote:

On Tue, Mar 6, 2012 at 11:36 AM, Bernt Hanssonb...@bananmonarki.se  wrote:


Again, a problem is that packages can only be generated

if the port has been installed


Why is that. I hope you can educate me on that.


Because a package is the result of what is installed.  It essentially works
somewhat like Debian's checkinstall by keeping track of what's installed by
the installation script, then using the info of what's installed to build
the package.  I'm not exactly sure how make package works internally, but
it wouldn't surprise me if it's almost the same as pkg_create -b.
From what I understand of ports (as a maintainer) that is the case; 
plus some other bits and pieces for checking, verification, and cleanup.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


port to package amd64 to i386

2012-03-05 Thread Bernt Hansson

Hello list

I want to build packages from ports on AMD64 for use on i386
since the i386 system is;


pid 21629 (cc1plus), uid 0, was killed: out of swap space

When building firefox.

Added some swap as a file so it's building as I type.

Thinking that the AMD system I can access is a wee more powerfull
than the i386, I was thinking in the line of;

Build the port on amd64 and install it on i386 as a package.

Is it possible? Pointers? Handholding? How-to?

This is the i386;

FreeBSD 8.2-RELEASE #0: Fri Feb 18 02:24:46 UTC 2011
r...@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
Timecounter i8254 frequency 1193182 Hz quality 0
CPU: Intel(R) Pentium(R) 4 CPU 2.53GHz (2524.94-MHz 686-class CPU)
  Origin = GenuineIntel  Id = 0xf27  Family = f  Model = 2  Stepping 
= 7 
Features=0xbfebfbffFPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE

Features2=0x400CNXT-ID
real memory  = 537395200 (512 MB)
avail memory = 498135040 (475 MB)


This is the amd64;

FreeBSD 8.2-STABLE #0: Thu Jan 12 15:13:06 CET 2012 
user@fqdn:/usr/home/user/disk8/obj/usr/home/user/disk8/src/sys/GENERIC amd64

Timecounter i8254 frequency 1193182 Hz quality 0
CPU: AMD Athlon(tm) II X2 250 Processor (3013.63-MHz K8-class CPU)
  Origin = AuthenticAMD  Id = 0x100f63  Family = 10  Model = 6 
Stepping = 3


Features=0x178bfbffFPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT
Features2=0x802009SSE3,MON,CX16,POPCNT
AMD 
Features=0xee500800SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM,3DNow!+,3DNow!
AMD 
Features2=0x37ffLAHF,CMP,SVM,ExtAPIC,CR8,ABM,SSE4A,MAS,Prefetch,OSVW,IBS,SKINIT,WDT

TSC: P-state invariant
real memory  = 17179869184 (16384 MB)
avail memory = 16523640832 (15758 MB)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: port to package amd64 to i386

2012-03-05 Thread Edward M.

On 03/05/2012 12:42 AM, Bernt Hansson wrote:

Build the port on amd64 and install it on i386 as a package.

Is it possible? Pointers? Handholding? How-to? 




http://filipenf.wordpress.com/2011/10/18/cross-compiling-for-x86-in-freebsd-64-bit/

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: port to package amd64 to i386

2012-03-05 Thread Bernt Hansson



2012-03-05 10:20, Edward M. skrev:

On 03/05/2012 12:42 AM, Bernt Hansson wrote:

Build the port on amd64 and install it on i386 as a package.

Is it possible? Pointers? Handholding? How-to?



http://filipenf.wordpress.com/2011/10/18/cross-compiling-for-x86-in-freebsd-64-bit/


Thank you for the pointer. I do find it a bit overkill to setup jails 
and such, just to build a few ports. I was thinking more along the line of;


cd /usr/ports/random port

make it for i386 even if we are building it on amd64, ooh by the way 
build it as a package, and all dependencies as packages as well


Oh man, man ports. But I do not find the flag 
-build-for-another-system-cpu-whatever


Can the ports system be (ab)used in that way?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: port to package amd64 to i386

2012-03-05 Thread Matthew Seaman
On 05/03/2012 16:42, Bernt Hansson wrote:
 
 Thank you for the pointer. I do find it a bit overkill to setup jails
 and such, just to build a few ports. I was thinking more along the line of;
 
 cd /usr/ports/random port
 
 make it for i386 even if we are building it on amd64, ooh by the way
 build it as a package, and all dependencies as packages as well
 
 Oh man, man ports. But I do not find the flag
 -build-for-another-system-cpu-whatever
 
 Can the ports system be (ab)used in that way?

In general, no.  There may be some ports that you could cross-compile,
but that depends on the upstream software having support for cross
compilation (basically allowing --target foo into the compilation
flags.) Even if you fix that you're going to run into difficulties as
soon as you try and compile a port that depends on shared libraries from
another port.  I don't think there's any mechanism for installing 32-bit
shlibs into ${LOCALBASE}/lib32 from packages.

Oh, and making packages is potentially a mine field, as you need to
install the port in order to package it.

About the only way to cross-build ports is to set up a 32-bit jail on a
64-bit host.  I believe that is do-able, but I could be delusional.

Cheers,

Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.   7 Priory Courtyard
  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate
JID: matt...@infracaninophile.co.uk   Kent, CT11 9PW



signature.asc
Description: OpenPGP digital signature


Re: port to package amd64 to i386

2012-03-05 Thread Polytropon
On Mon, 05 Mar 2012 17:42:58 +0100, Bernt Hansson wrote:
 Thank you for the pointer. I do find it a bit overkill to setup jails 
 and such, just to build a few ports.

The problem here is that a specific build environment
is required.



 I was thinking more along the line of;
 
 cd /usr/ports/random port
 
 make it for i386 even if we are building it on amd64, ooh by the way 
 build it as a package, and all dependencies as packages as well

Again, a problem is that packages can only be generated
if the port has been installed, which is the make package
task typically following make install, resulting in the
desired package in the /usr/ports/packages/ subtree. See
man ports regarding the package target. I think that
_could_ be overridden by specifying a different, temporary
$PREFIX to install to, but I haven't tested this approach.

For the dependencies, I think there was a setting to be
included in /etc/make.conf... MAKE_DEPENDS=PACKAGE? Something
like this will cause all dependencies to be built and
archived as a package.



 Oh man, man ports. But I do not find the flag 
 -build-for-another-system-cpu-whatever

Some settings can be transferred to the make environment,
usually /etc/make.conf is used.



 Can the ports system be (ab)used in that way?

I don't think it is that easy. :-(


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: port to package amd64 to i386

2012-03-05 Thread Chris Whitehouse

On 05/03/2012 16:53, Matthew Seaman wrote:

On 05/03/2012 16:42, Bernt Hansson wrote:


Thank you for the pointer. I do find it a bit overkill to setup jails
and such, just to build a few ports. I was thinking more along the line of;

cd /usr/ports/random port

make it for i386 even if we are building it on amd64, ooh by the way
build it as a package, and all dependencies as packages as well




About the only way to cross-build ports is to set up a 32-bit jail on a
64-bit host.  I believe that is do-able, but I could be delusional.


Could you do it in a tinderbox? This thread

http://www.marcuscom.com/pipermail/tinderbox-list/2011-June/002177.html

discusses it a bit with a possible solution. Things have probably moved 
on since then which may or may not help.


Chris

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org