DaemonForums  

Go Back   DaemonForums > NetBSD > NetBSD Package System (pkgsrc)

NetBSD Package System (pkgsrc) Installation and upgrading of packages on NetBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 23rd March 2020
Sensucht94's Avatar
Sensucht94 Sensucht94 is offline
Real Name: Paolo Vincenzo Olivo
Shell Scout
 
Join Date: Oct 2017
Location: Rome
Posts: 97
Post share your mk.conf!: pkgsrc best practices

Greetings everybody; the idea of having a similar thread has crossed my mind a couple of times already, so I thought I'd better start one now that I have some more spare time.
Below the /etc/mk.conf I use on my Odroid C2. Replies - if ever there will be any - are very appreciated.
Code:
## GENERAL SETTINGS
# machine-specific workdirs
OBJMACHINE=yes
# sanity checks for shared libs
PKG_DEVELOPER=yes
# default pkg prefix
LOCALBASE=/usr/pkg
# build on tmpfs
WRKOBJDIR=/var/tmp/pkg
# sign pckgs with a trusted CA cert
SIGN_PACKAGES=x509
X509_CERTIFICATE=/etc/openssl/certs/pkgsrc.crt
X509_KEY=/etc/openssl/private/pkgsrc.key
# where to store generated packages
PACKAGES?=${_PKGSRCDIR}/packages/${MACHINE_ARCH}
# used to elevate privileges
.if exists(${LOCALBASE}/bin/doas)
SU_CMD=${LOCALBASE}/bin/doas /bin/sh -c
.endif
# default 'make clean' on deps
CLEANDEPENDS=YES
# use binary packages for dependencies
UPDATE_TARGET=bin-install
BINPKG_SITES=$(${LOCALBASE}/bin/gawk '{ print $2 }' FS='=' /etc/pkg_install.conf)

## FETCHING DISTFILES
# resume downloads 
PKG_RESUME_TRANSFERS=YES
# fetch using wget
.if exists(${LOCALBASE}/bin/wget)
FETCH_CMD=${LOCALBASE}/bin/wget
.endif
FETCH_BEFORE_ARGS=–passive-ftp
FETCH_RESUME_ARGS=-c
FETCH_OUTPUT_ARGS=-O
# preferred domains list
MASTER_SORT=.eu .it .ch .at .fr .de .es .nl .uk .at .be .cz .pl .se .fi .no .dk

## HARDENING
ALLOW_VULNERABLE_PACKAGES=NO
# stack protector
PKGSRC_USE_SSP?=strong
# fortify source
PKGSRC_USE_FORTIFY?=strong
# position-independent executables
PKGSRC_MKPIE?=yes
# link with RELRO
#PKGSRC_USE_RELRO?=partial
# stack boundary verification
PKGSRC_USE_STACK_CHECK?= yes

## OPTIMIZATIONS
MAKE_JOBS=4
GZIP?=--fast
CPUFLAGS+=-O3 -pipe -fomit-frame-pointer -mcpu=cortex-a53 -mtune=cortex-a53 -mfpu=neon-fp16 -mfloat-abi=hard -funsafe-math-optimizations 

## PKG_ALTERNATIVES
PYTHON_VERSION_DEFAULT=37
LUA_VERSION_DEFAULT=53
PHP_VERSION_DEFAULT=71
RUBY_VERSION_DEFAULT=24
# avoid linking against outdated libs
PREFER_PKGSRC?=MesaLib Xft2 Xrandr Xrender expat fontconfig freetype2 glu openssl pixman xcursor

## LICENSES
ACCEPTABLE_LICENSES+=erlang-public-license gnu-agpl-v3 lame-license ms-ttf-license no-commercial-use opemotif-license public-domain unrar-license ruby-license sendmail-open-source-license  sun-jdk14-license vim-license xv-license
__________________
“Mi casa tendrá dos piernas y mis sueños no tendrán fronteras„

Last edited by Sensucht94; 24th March 2020 at 09:57 AM. Reason: fix typo
Reply With Quote
  #2   (View Single Post)  
Old 24th March 2020
bashrules's Avatar
bashrules bashrules is offline
Aspiring Unix Greybeard
 
Join Date: Mar 2010
Location: Here
Posts: 61
Default

If I'm not mistaken, /etc/mk.conf is also used for building the kernel. Are you sure you want to build your kernel with all these fancy CPUFLAGS?

Whatever is only relevant for pkgsrc, I put in such a ifdef block

Code:
.ifdef BSD_PKG_MK

Fancy Stuff goes here

.endif

Quote:
Originally Posted by Sensucht94 View Post
Code:
xv-license
Glad to see another xv user
Reply With Quote
  #3   (View Single Post)  
Old 24th March 2020
Sensucht94's Avatar
Sensucht94 Sensucht94 is offline
Real Name: Paolo Vincenzo Olivo
Shell Scout
 
Join Date: Oct 2017
Location: Rome
Posts: 97
Default

Hi [USER=2445]bashrules][/USER], thanks for replying

Quote:
Originally Posted by bashrules View Post
If I'm not mistaken, /etc/mk.conf is also used for building the kernel. Are you sure you want to build your kernel with all these fancy CPUFLAGS?
I certainly wouldn't ; to be honest, I've become more lazy lately due to lack of time (all the more given the limited horsepower of the Odroid, but yes, I might as well cross-compile), so I prefer just to fetching the last official 64bit image for OdroidC2 from armbsd.org no sooner bugs are patched or a new release comes out.

Quote:

Whatever is only relevant for pkgsrc, I put in such a ifdef block
Code:
.ifdef BSD_PKG_MK

Fancy Stuff goes here

 .endif
Thanks for the tip, simple and life-saving, will come in handy

Quote:
Glad to see another xv user
__________________
“Mi casa tendrá dos piernas y mis sueños no tendrán fronteras„
Reply With Quote
  #4   (View Single Post)  
Old 29th March 2020
bashrules's Avatar
bashrules bashrules is offline
Aspiring Unix Greybeard
 
Join Date: Mar 2010
Location: Here
Posts: 61
Default

Hello Sensucht,

Quote:
Originally Posted by Sensucht94 View Post

Quote:
Glad to see another xv user
I love pkgsrc for various reasons. One is the ability to nicely integrate custom patches via

Code:
LOCALPATCHES=   /home/bashrules/pkgsrc/patches
Here is an example for xv. Note the directory hierachy - it must model pkgsrc' directory hierachy. Upon saving a jpeg, xv adds itself to the jpeg meta-data which I disable with this patch

Code:
$ cat ~/pkgsrc/patches/graphics/xv/patch-CREATOR.patch 
--- xvjpeg.c.orig	2012-02-14 22:52:40.000000000 -0800
+++ xvjpeg.c	2012-02-14 22:53:07.000000000 -0800
@@ -977,7 +977,6 @@
   else comment = xvcmt;
 
 
-  jpeg_write_marker(&cinfo, JPEG_COM, (byte *)comment, (u_int)strlen(comment));
 
   if (picExifInfo) jpeg_write_marker(&cinfo, JPEG_APP1, (byte *)picExifInfo,
                                      (u_int)picExifInfoSize);
And so I have here and there some small patches.


Pkgsrc is not perfect. There is always a package or two that does not build. If the problem is in the actual code, I can keep /usr/pkgsrc/ untouched and put my patch into LOCALPATCHES.

Last edited by bashrules; 30th March 2020 at 03:09 AM.
Reply With Quote
  #5   (View Single Post)  
Old 31st March 2020
Sensucht94's Avatar
Sensucht94 Sensucht94 is offline
Real Name: Paolo Vincenzo Olivo
Shell Scout
 
Join Date: Oct 2017
Location: Rome
Posts: 97
Default

Quote:
Originally Posted by bashrules View Post
Pkgsrc is not perfect. There is always a package or two that does not build. If the problem is in the actual code, I can keep /usr/pkgsrc/ untouched and put my patch into LOCALPATCHES.
Precisely, in few words you described my same feeling over it:

- on one hand, one may dislike pkgsrc because a) each and every quarterly release breaks some package; b) deprecated software is systematically left there dying out, awaiting for somebody to take maintainership, if ever; c) support outside Tier I platforms is limited, while bootstrapping outside mainstream target (NetBSD, Illumos, macOS, Linux, QNX) is hackish at best and never devoid of unwanted surprises. Long gone are the days where pkgsrc would work almost shamelessly on IRIX, Solaris 10, HP-UX: I'd be surprised to hear about somebody having ccessfully built a pkgsrc-based HP-UX desktop on a PA-RISC workstation like here (2011)

- on the other hand, I'm under the impression the majority of users can't help falling in love with it: it's simple, fast, powerful, portable, well-documented, hackable, and, most prominently, doesn't get in the way. For me its versatility is a killer feature: being able to use the same package manager on NetBSD and Slackware is something I'd hardly be able to live without now. Same goes for the cross toolchain (used it to build for evbarm64 on 8.99-current before binary packages became a reality). And the interesting thing is that I first moved to NetBSD after having used pkgsrc on Solaris/illumos first and macOS later. Promptly getting security patches on quarterly releases is another thing I endorse. Finally, it must be noted how easy is it to start contributing: the community is very inclusive and welcoming, eager to provide help and walk new committers through
__________________
“Mi casa tendrá dos piernas y mis sueños no tendrán fronteras„

Last edited by Sensucht94; 31st March 2020 at 11:57 PM. Reason: further elaborated on a couple of points
Reply With Quote
Reply

Tags
building, netbsd, options, package management, pkgsrc

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Seven Most .. please share with us .. daemonfowl Off-Topic 19 29th July 2013 11:34 PM
what are your best practices to ensure privacy ? daemonfowl OpenBSD Security 11 4th April 2012 12:05 AM
Disaster recovery best practices RandomSF FreeBSD General 8 7th December 2010 06:41 AM
Which is the significance about pkgsrc-2009Q2 and pkgsrc-2009Q3? aleunix NetBSD Package System (pkgsrc) 3 16th December 2009 07:19 AM
pf Share problem! jleal OpenBSD Security 6 25th August 2008 04:08 AM


All times are GMT. The time now is 04:14 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick