building pacman for a customer foloder

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

building pacman for a customer foloder

pacman-dev mailing list
Hello Pacman Team,



I was trying to build Pacman for installation into a custom folder.  



I downloaded the following pacman source code:

https://sources.archlinux.org/other/pacman/pacman-5.0.2.tar.gz



I then ran the following configure command:

./configure --prefix=/usr/local/pacman/ --disable-doc --disable-shared



After this is seems to be using --prefix for make install but not when building.  The binaries assume a location of /usr/local.  See below for details.  How do I build pacman to run from a custom directory?




To make install I run

$make

$sudo mkdir /usr/local/pacman

$sudo chown localuser:localuser /usr/local/pacman/

$make install



At this point it has installed pacman executable at:



$ls /usr/local/pacman/bin/pacman

/usr/local/pacman/bin/pacman





The configuration file can be found at

$ls /usr/local/pacman/etc/pacman.conf

/usr/local/pacman/etc/pacman.conf



However when I run pacman I get an error, like the following:

$ /usr/local/pacman/bin/pacman -U ~/mist.tar.gz

error: config file /usr/local/etc/pacman.conf could not be read: No such file or directory



If I go and link the file:

$sudo ln -s /usr/local/pacman/etc/pacman.conf /usr/local/etc/



Then run pacman again I still get an error, just now with the var folder:



$/usr/local/pacman/bin/pacman -U ~/mist.tar.gz

error: failed to initialize alpm library

(could not find or read directory: /usr/local/var/lib/pacman/)







It seems to be taking the prefix for installation but not for compile.  What do I need to change to make it run from a different prefix?



Michael Power​










Reply | Threaded
Open this post in threaded view
|

Re: building pacman for a customer foloder

Allan McRae
On 07/03/18 12:49, pacman-dev via pacman-dev wrote:

> Hello Pacman Team,
>
>
>
> I was trying to build Pacman for installation into a custom folder.  
>
>
>
> I downloaded the following pacman source code:
>
> https://sources.archlinux.org/other/pacman/pacman-5.0.2.tar.gz
>
>
>
> I then ran the following configure command:
>
> ./configure --prefix=/usr/local/pacman/ --disable-doc --disable-shared
>
>
>
> After this is seems to be using --prefix for make install but not when building.  The binaries assume a location of /usr/local.  See below for details.  How do I build pacman to run from a custom directory?
>
>

  Build information:
    source code location   : .
    prefix                 : /usr/local/pacman
    sysconfdir             : /usr/local/pacman/etc
       conf file           : /usr/local/pacman/etc/pacman.conf
    localstatedir          : /usr/local/pacman/var
       database dir        : /usr/local/pacman/var/lib/pacman/
       cache dir           : /usr/local/pacman/var/cache/pacman/pkg/

$ ./src/pacman/pacman
error: config file /usr/local/pacman/etc/pacman.conf could not be read:
No such file or directory


Looks fine to me.

A
Reply | Threaded
Open this post in threaded view
|

Re: building pacman for a customer foloder

Eli Schwartz-2
In reply to this post by pacman-dev mailing list
On 03/06/2018 09:49 PM, pacman-dev via pacman-dev wrote:
> It seems to be taking the prefix for installation but not for
> compile.  What do I need to change to make it run from a different
> prefix?

Okay, first of all you are using way, way too many blank lines in your
email and that is super distracting, so please fix that in the future.
This is not a college paper, you don't need to double-space everything.

As for the prefix issue, I am honestly not understanding the problem.
You wanted to compile pacman to use a custom installation directory, and
that is *exactly* what pacman did with `--prefix`.

Yes, prefix changes where the pacman binary goes, and it changes where
the libalpm.so library goes... and it also changes where the sysconfdir
and localstatedir go. You are of course entirely free to change the
defaults for those as well, for example to continue using the same
configuration and databases used by the repository package for pacman,
you simply specify `--sysconfdir=/etc --localstatedir=/var`

P.S. these options are pretty standard autotools things, so this is
generic knowledge that will apply across many coding projects. :)

--
Eli Schwartz
Bug Wrangler and Trusted User


signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: building pacman for a customer foloder

pacman-dev mailing list
In reply to this post by Allan McRae
Tried opt too, same result:

pacman:



  Build information:

    source code location   : .

    prefix                 : /opt/local/pacman

    sysconfdir             : /opt/local/pacman/etc

       conf file           : /opt/local/pacman/etc/pacman.conf

    localstatedir          : /opt/local/pacman/var

       database dir        : /opt/local/pacman/var/lib/pacman/

       cache dir           : /opt/local/pacman/var/cache/pacman/pkg/



    compiler               : gcc -std=gnu99

    preprocessor flags     :

    compiler flags         : -Wall -g -O2

    library flags          : -lm  -L/usr/lib/x86_64-linux-gnu -lcrypto   -L/usr/lib/x86_64-linux-gnu -larchive    

    linker flags           :



    Architecture           : x86_64

    Host Type              : x86_64-unknown-linux-gnu

    File inode command     : stat -c '%i %n'

    File owner command     : stat -c '%u:%g'

    File mode command      : stat -c '%a'

    Filesize command       : stat -c %s

    In-place sed command   : sed --follow-symlinks -i



    libalpm version        : 10.0.2

    libalpm version info   : 10:2:0

    pacman version         : 5.0.2

    using git version      : no



  Directory and file information:

    root working directory : /

    package extension      : .pkg.tar.gz

    source pkg extension   : .src.tar.gz

    build script name      : PKGBUILD

    template directory     : /usr/share/makepkg-template



  Compilation options:

    Use libcurl            : no

    Use GPGME              : no

    Use OpenSSL            : yes

    Run make in doc/ dir   : no

    Doxygen support        : no

    debug support          : no

    extra warning flags    : no

    use git version        : no



michaelpower@local-ic:~/Workspace/pacman-5.0.2$ ./src/pacman/

.deps/  .libs/  pacman  po/    

michaelpower@local-ic:~/Workspace/pacman-5.0.2$ ./src/pacman/pacman

error: config file /usr/local/etc/pacman.conf could not be read: No such file or directory





---- On Tue, 06 Mar 2018 19:05:50 -0800 Allan McRae <[hidden email]> wrote ----




On 07/03/18 12:49, pacman-dev via pacman-dev wrote:

> Hello Pacman Team,

>

>

>

> I was trying to build Pacman for installation into a custom folder.

>

>

>

> I downloaded the following pacman source code:

>

> https://sources.archlinux.org/other/pacman/pacman-5.0.2.tar.gz 

>

>

>

> I then ran the following configure command:

>

> ./configure --prefix=/usr/local/pacman/ --disable-doc --disable-shared

>

>

>

> After this is seems to be using --prefix for make install but not when building. The binaries assume a location of /usr/local. See below for details. How do I build pacman to run from a custom directory?

>

>

 

 Build information:

 source code location : .

 prefix : /usr/local/pacman

 sysconfdir : /usr/local/pacman/etc

 conf file : /usr/local/pacman/etc/pacman.conf

 localstatedir : /usr/local/pacman/var

 database dir : /usr/local/pacman/var/lib/pacman/

 cache dir : /usr/local/pacman/var/cache/pacman/pkg/

 

$ ./src/pacman/pacman

error: config file /usr/local/pacman/etc/pacman.conf could not be read:

No such file or directory

 

 

Looks fine to me.

 

A