version 1.5, 2014/07/09 12:28:19
|
version 1.10, 2021/11/02 13:53:21
|
Line 13 listed below:
|
Line 13 listed below:
|
## pkgsrc tree |
## pkgsrc tree |
|
|
You should have a copy of the pkgsrc tree sitting somewhere on your |
You should have a copy of the pkgsrc tree sitting somewhere on your |
disk, already bootstrapped, see this [blog |
disk, already bootstrapped. |
post](http://saveosx.org/pkgsrc-bootstrap/) on how to do this. |
|
|
|
The tree contains a `Makefile`, a `README`, distfiles, packages, |
The tree contains a `Makefile`, a `README`, distfiles, packages, |
category directories containing the ports, the bootstrap directory |
category directories containing the ports, the bootstrap directory |
and some documentation. |
and some documentation. |
Line 92 long ago in pkgsrc-wip
|
Line 90 long ago in pkgsrc-wip
|
|
|
Makefile: |
Makefile: |
|
|
[[!format make """ |
[[!format makefile """ |
# [[!paste id=rcsid1]][[!paste id=rcsid2]] |
# [[!paste id=rcsid1]][[!paste id=rcsid2]] |
|
|
PKGNAME= osxinfo-0.1 |
PKGNAME= osxinfo-0.1 |
Line 117 WRKSRC= ${WRKDIR}/osxinfo-${GHCOMMIT}
|
Line 115 WRKSRC= ${WRKDIR}/osxinfo-${GHCOMMIT}
|
|
|
DESCR: |
DESCR: |
|
|
Small and fast Mac OS X info program written in C |
Small and fast Mac OS X info program written in C. |
by Youri Mouton. |
|
|
|
|
|
PLIST: |
PLIST: |
Line 200 these targets, like
|
Line 197 these targets, like
|
The framework uses an `mk.conf` file, usually found in /etc. Here's |
The framework uses an `mk.conf` file, usually found in /etc. Here's |
how mine looks: |
how mine looks: |
|
|
[[!format make """ |
[[!format makefile """ |
# Tue Oct 15 21:21:46 CEST 2013 |
# Tue Oct 15 21:21:46 CEST 2013 |
|
|
.ifdef BSD_PKG_MK # begin pkgsrc settings |
.ifdef BSD_PKG_MK # begin pkgsrc settings |
Line 269 PKG_DEFAULT_OPTIONS+= -pulseaudio -
|
Line 266 PKG_DEFAULT_OPTIONS+= -pulseaudio -
|
I disabled a few options so less ports would break, pulseaudio |
I disabled a few options so less ports would break, pulseaudio |
doesn't build on Mac OS X for example, neither do x264, dconf |
doesn't build on Mac OS X for example, neither do x264, dconf |
|
|
Keep in mind that there are many other available options documented |
Keep in mind that there are many other available options. |
in the official pkgsrc guide. |
|
|
|
|
|
## creating a simple port |
## creating a simple port |
Line 316 on the program's homepage.
|
Line 312 on the program's homepage.
|
Here's how they look like at the moment: |
Here's how they look like at the moment: |
|
|
Makefile: |
Makefile: |
[[!format make """ |
[[!format makefile """ |
# [[!paste id=rcsid1]][[!paste id=rcsid2]] |
# [[!paste id=rcsid1]][[!paste id=rcsid2]] |
|
|
DISTNAME= 2bwm-0.1 |
DISTNAME= 2bwm-0.1 |
Line 399 in our Makefile.
|
Line 395 in our Makefile.
|
Clean, build again, and add more dependencies until it passes the |
Clean, build again, and add more dependencies until it passes the |
build stage. Here's how my Makefile ends up looking like: |
build stage. Here's how my Makefile ends up looking like: |
|
|
[[!format make """ |
[[!format makefile """ |
# [[!paste id=rcsid1]][[!paste id=rcsid2]] |
# [[!paste id=rcsid1]][[!paste id=rcsid2]] |
|
|
DISTNAME= 2bwm-0.1 |
DISTNAME= 2bwm-0.1 |
Line 456 how 2bwm installs:
|
Line 452 how 2bwm installs:
|
|
|
From 2bwm's Makefile: |
From 2bwm's Makefile: |
|
|
[[!format make """ |
[[!format makefile """ |
install: $(TARGETS) |
install: $(TARGETS) |
test -d $(DESTDIR)$(PREFIX)/bin || mkdir -p $(DESTDIR)$(PREFIX)/bin |
test -d $(DESTDIR)$(PREFIX)/bin || mkdir -p $(DESTDIR)$(PREFIX)/bin |
install -pm 755 2bwm $(DESTDIR)$(PREFIX)/bin |
install -pm 755 2bwm $(DESTDIR)$(PREFIX)/bin |
Line 554 You should be able to fix the prefix err
|
Line 550 You should be able to fix the prefix err
|
the patching explained above thanks to the sed substitution framework. |
the patching explained above thanks to the sed substitution framework. |
Here's how it looks like in my port Makefile: |
Here's how it looks like in my port Makefile: |
|
|
[[!format make """ |
[[!format makefile """ |
SUBST_CLASSES+= makefile |
SUBST_CLASSES+= makefile |
SUBST_STAGE.makefile= pre-build |
SUBST_STAGE.makefile= pre-build |
SUBST_MESSAGE.makefile= Fixing makefile |
SUBST_MESSAGE.makefile= Fixing makefile |
Line 596 You can find the 2bwm port I submitted i
|
Line 592 You can find the 2bwm port I submitted i
|
## pkgsrc and wip |
## pkgsrc and wip |
|
|
If you want to submit your port for others to use you can either |
If you want to submit your port for others to use you can either |
subscribe to pkgsrc-wip or ask a NetBSD developer to add it for you |
subscribe to pkgsrc-wip or ask a NetBSD developer to add it for you. |
which can be tough. Even though there are many IRC channels in which |
|
you can find nice developers, you will have to take the time to get |
|
to know them. The easiest way for beginners is to submit to pkgsrc-wip |
|
so other people can review and test it first. |
|
|
|
pkgsrc-wip is hosted on |
pkgsrc-wip is hosted on |
[sourceforge](https://sourceforge.net/projects/pkgsrc-wip/) and you |
[sourceforge](https://sourceforge.net/projects/pkgsrc-wip/) and you |
can easily get cvs access to it if you create an account on there |
can easily get cvs access to it if you create an account on there |
and send an email to NetBSD developer `@wiz` (Thomas Klausner) |
and send an email to NetBSD developer `@wiz` (Thomas Klausner) |
asking nicely for commit access. I got access fairly quickly and |
asking nicely for commit access. |
he even fixed a port to show me how to do it properly. |
|
|
|
You can also send me an email or talk to me on IRC so I can submit it for you. |
|
|
|
|
|
## the options framework |
## the options framework |
Line 617 You can also send me an email or talk to
|
Line 606 You can also send me an email or talk to
|
You can create port options with the `options.mk` file, like for `wm/dwm` |
You can create port options with the `options.mk` file, like for `wm/dwm` |
|
|
|
|
[[!format make """ |
[[!format makefile """ |
# [[!paste id=rcsid1]][[!paste id=rcsid2]] |
# [[!paste id=rcsid1]][[!paste id=rcsid2]] |
|
|
PKG_OPTIONS_VAR= PKG_OPTIONS.dwm |
PKG_OPTIONS_VAR= PKG_OPTIONS.dwm |
Line 680 packages available for testing. You will
|
Line 669 packages available for testing. You will
|
on the host system. I host my [packages](http://pkgsrc.saveosx.org/) |
on the host system. I host my [packages](http://pkgsrc.saveosx.org/) |
on a FreeBSD server with a bootstrapped pkgsrc. |
on a FreeBSD server with a bootstrapped pkgsrc. |
|
|
I use this `zsh` function to : |
use this shell function to : |
|
|
[[!format make """ |
[[!format sh """ |
add () { |
add () { |
# upload the package to remote server |
# upload the package to remote server |
scp $1 yrmt@saveosx.org:/usr/local/www/saveosx/packages/Darwin/2013Q4/x86_64/All/ 2> /dev/null |
scp $1 youri@saveosx.org:/usr/local/www/saveosx/packages/Darwin/2013Q4/x86_64/All/ 2> /dev/null |
|
|
# update the package summary |
# update the package summary |
ssh yrmt@saveosx.org 'cd /usr/local/www/saveosx/packages/Darwin/2013Q4/x86_64/All/; |
ssh youri@saveosx.org 'cd /usr/local/www/saveosx/packages/Darwin/2013Q4/x86_64/All/; |
rm pkg_summary.gz; |
rm pkg_summary.gz; |
/usr/pkg/sbin/pkg_info -X *.tgz | gzip -9 > pkg_summary.gz' |
/usr/pkg/sbin/pkg_info -X *.tgz | gzip -9 > pkg_summary.gz' |
|
|
Line 722 add () {
|
Line 711 add () {
|
REQUIRES=/usr/pkg/lib/libsqlite3.0.dylib |
REQUIRES=/usr/pkg/lib/libsqlite3.0.dylib |
FILE_NAME=osxinfo-0.1.tgz |
FILE_NAME=osxinfo-0.1.tgz |
FILE_SIZE=9710 |
FILE_SIZE=9710 |
DESCRIPTION=Small and fast Mac OS X info program written in C |
DESCRIPTION=Small and fast Mac OS X info program written in C. |
DESCRIPTION=by Youri Mouton. |
|
DESCRIPTION= |
DESCRIPTION= |
DESCRIPTION=Homepage: |
DESCRIPTION=Homepage: |
DESCRIPTION=http://github.com/yrmt/osxinfo |
DESCRIPTION=http://github.com/yrmt/osxinfo |
Line 735 add () {
|
Line 723 add () {
|
And this shell alias to upload all my built packages, but I still |
And this shell alias to upload all my built packages, but I still |
need to run `add()` mentionned above to update the pkg_summary |
need to run `add()` mentionned above to update the pkg_summary |
|
|
[[!format bash """ |
[[!format sh """ |
up='rsync -avhz --progress /pkgsrc/packages/ root@saveosx.org:/usr/local/www/saveosx/packages/Darwin/2013Q4/x86_64/' |
up='rsync -avhz --progress /pkgsrc/packages/ youri@saveosx.org:/usr/local/www/saveosx/packages/Darwin/2013Q4/x86_64/' |
"""]] |
"""]] |
|
|
Then you should be able to set the url in repositories.conf to use |
Then you should be able to set the url in repositories.conf to use |
Line 748 course.
|
Line 736 course.
|
|
|
## build all packages |
## build all packages |
|
|
Bulk building pkgsrc packages is a topic for another post, see |
see jperkin's excellent blog |
jperkin's excellent blog |
|
[posts](http://www.perkin.org.uk/posts/distributed-chrooted-pkgsrc-bulk-builds.html) |
[posts](http://www.perkin.org.uk/posts/distributed-chrooted-pkgsrc-bulk-builds.html) |
about this. |
about this. |
|
|
Line 767 earlier like this:
|
Line 754 earlier like this:
|
|
|
pkgsrc supports fetching archives from specific git commits on |
pkgsrc supports fetching archives from specific git commits on |
GitHub like this: |
GitHub like this: |
[[!format make """ |
[[!format makefile """ |
PKGNAME= 2bwm-0.1 |
PKGNAME= 2bwm-0.1 |
CATEGORIES= wm |
CATEGORIES= wm |
GHCOMMIT= 52a097ca644eb571b22a135951c945fcca57a25c |
GHCOMMIT= 52a097ca644eb571b22a135951c945fcca57a25c |
Line 786 You can do all Makefile operations direc
|
Line 773 You can do all Makefile operations direc
|
like this: |
like this: |
|
|
|
|
[[!format make """ |
[[!format makefile """ |
post-extract: |
post-extract: |
${CHMOD} a-x ${WRKSRC}/elementary/apps/48/internet-mail.svg |
${CHMOD} a-x ${WRKSRC}/elementary/apps/48/internet-mail.svg |
|
|
Line 798 do-install:
|
Line 785 do-install:
|
To install, but you can also build programs from the Makefile. This |
To install, but you can also build programs from the Makefile. This |
is what qt4-sqlite3 uses: |
is what qt4-sqlite3 uses: |
|
|
[[!format make """ |
[[!format makefile """ |
do-build: |
do-build: |
cd ${WRKSRC}/src/tools/bootstrap && env ${MAKE_ENV} ${GMAKE} |
cd ${WRKSRC}/src/tools/bootstrap && env ${MAKE_ENV} ${GMAKE} |
cd ${WRKSRC}/src/tools/moc && env ${MAKE_ENV} ${GMAKE} |
cd ${WRKSRC}/src/tools/moc && env ${MAKE_ENV} ${GMAKE} |