Difference between revisions of "Hugin Compiling FreeBSD"

From PanoTools.org Wiki
Jump to: navigation, search
(Change compiling category)
m (Update current FreeBSD version)
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Hugin is part of the FreeBSD [http://www.freebsd.org/cgi/cvsweb.cgi/ports/graphics/hugin/ ports collection]. Using the ports collection (and contributing fixes to it) is the recommended way to install Hugin on FreeBSD.
+
Hugin is part of the FreeBSD [http://www.freebsd.org/cgi/cvsweb.cgi/ports/graphics/hugin/ ports collection]. Using the ports collection (and contributing fixes to it) is the recommended way to install Hugin on FreeBSD.  The Hugin port is currently maintained by Vasil Dimov <vd (at) FreeBSD.org>.
  
 
== Install with the port ==
 
== Install with the port ==
Line 12: Line 12:
 
== Update the port ==
 
== Update the port ==
  
{| style="margin: 1em auto 1em 1em;background:#FFFF99;color:#FF0000;text-align:left;border: solid #FF3300;"
+
To track Hugin's releases, after each new release edit the following files in the Ports Collection:
|-valign="top"
+
! '''WARNING:'''
+
Below is newbie's work in progress. Following these instructions may corrupt your FreeBSD system or worse. Exercise caution (read: don't do this) until the experts confirm that the newbie has done things rights.
+
|}
+
  
to track closely Hugin's releases, after each new release edit the following files in the ports collection:
+
1. Create a directory '''/usr/ports/graphics/hugin-new''' with the same contents as '''/usr/ports/graphics/hugin'''.  Copy the files '''Makefile''', '''pkg-descr''' and '''pkg-plist''' from '''/usr/ports/graphics/hugin''' to '''/usr/ports/graphics/hugin-new'''
  
1. edit '''[http://www.freebsd.org/cgi/cvsweb.cgi/ports/graphics/hugin/distinfo?rev=1.8;content-type=text%2Fplain distinfo]''' to point to the right tarball. You will need to edit the name in parenthesis, to calculate and edit the md5 and sha256 hashes, to edit the filesize.
+
2. Edit the '''Makefile''':
 +
* Set PORTVERSION to the name of the new release (e.g. 2011.2.0).
 +
* Set PORTREVISION to 0
 +
* Change any necessary build dependencies in LIB_DEPENDS
 +
* Change any necessary runtime dependencies in RUN_DEPENDS
 +
* Change any necessary Cmake building arguments in CMAKE_ARGS
  
2. edit the '''Makefile'''.
+
3. Run ''make makesum'' to create the file '''distinfo'''.
* edit PORTVERSION and PORTREVISION
+
* add/update build dependencies to LIB_DEPENDS=
+
* add/update runtime dependencies to RUN_DEPENDS=
+
* add/update Cmake building arguments to CMAKE_ARGS=
+
* if you're not sure about something that need to be done, ask the experts.
+
  
3. edit the '''pkg-plist''' list of installed files. While it can't be done automatically, the trick is to 'make PREFIX=/tmp/foobar install' and then check the files under /tmp/foobar (assuming it was non-existent before)
+
4. Check the '''pkg-plist''' list of installed files and change if necessary. While it can't be done automatically, the trick is to ''make PREFIX=/tmp/foobar install'' and then check the files under '''/tmp/foobar''' (assuming it was non-existent before).
  
4. probably not necessary: edit the '''pkg-descr''' description of Hugin.
+
5. Probably not necessary: edit the '''pkg-descr''' description of Hugin.
  
make a diff and submit it to the FreeBSD experts.
+
6. Build and confirm that it works.
  
== files / patches ==
+
7. Make a diff and submit it to the FreeBSD maintainer (see at top).
  
{| style="margin: 1em auto 1em 1em;background:#FFFF99;color:#FF0000;text-align:left;border: solid #FF3300;"
+
If you would like to know more about porting software to FreeBSD see the [http://www.freebsd.org/doc/en/books/porters-handbook/ FreeBSD Porter's Handbook].
|-valign="top"
+
! '''Note:'''
+
This is a work in progress - mainly thoughts about simplifying / streamlining the patching to make life easier to the FreeBSD port maintainer. Please contribute if you have experience in this area.
+
|}
+
  
The patches are listed at http://www.freebsd.org/cgi/cvsweb.cgi/ports/graphics/hugin/files/
+
==Development versions==
  
=== CMake build ===
+
The FreeBSD Ports Collection expects to get the software in the form of a tarball. When using software checked out of the Mercurial repository, you will need to do some trickery.
* patch-CMakeLists.txt
+
* patch-doc_CMakeLists.txt
+
  
I think it makes sense for the variable mandir to be set in the general CMake build.
+
One method is to check out the version and then create a tarball for the Ports Collection to use, but it's easier to first check out a released version (for example the latest release) and then replace it with the version from the repository.  The following example assumes that the current release is version 2011.4.0:
  
if I put an IF(CMAKE_SYSTEM_NAME=="FreeBSD") condition and make the changes inside the Hugin repository, it should work, right?
+
CARE: The code below was wrong, and would have removed everything.  I have modified it so it's not so dangerous, but it's still wrong.  Watch this space.
  
 +
mkdir -p /usr/ports/graphics/hugin-devel
 +
cd /usr/ports/graphics/hugin                  ''note: the release directory''
 +
cp -p Makefile pkg-descr pkg-plist distinfo ../hugin-devel
 +
cd ../hugin-devel
 +
make patch                                    ''extracts the tarball''
 +
cd work
 +
mv hugin-2011.4.0 hugin-2011.4.0-old          ''we currently need this: see below''
 +
hg clone http://hugin.hg.sourceforge.net:8000/hgroot/hugin/hugin  ''check out the tip''
 +
mv hugin hugin-2011.4.0                      ''this is the name referred to the Makefile''
  
=== patch-src_hugin1_base_wx_RunStitchPanel.cpp ===
+
At this point you currently need to patch the tree. The [http://tclap.sourceforge.net/ tclap library] that used to be in Hugin has been removed, and until we decide what to do with the FreeBSD build, it will need to be replaced:
  
I think this one I can apply upstream as-is?
+
mkdir hugin-2011.4.0/src/foreign/tclap
 +
cp -p hugin-2011.4.0-old/src/foreign/tclap/* hugin-2011.4.0/src/foreign/tclap
  
 +
After this, you can build the version.  Change to the FreeBSD build directory, edit '''Makefile''' if necessary, and build.  If you already have an installed version which you want to keep, you can make a backup of it (second line below):
  
=== patch-src_hugin1_hugin_TextureManager.cpp ===
+
cd /usr/ports/graphics/hugin-devel
 +
pkg_create -b /var/db/pkg/hugin-2011.4.0          ''this usage allows file name completion''
 +
make install
  
Do I understand right that log2(x) is not defined in FreeBSD? and I fi put it inside a conditional expression, I could apply it upstream and it would coexist with the rest, e.g.
+
Note that the Ports Collection stores a number of dummy files in the subdirectory '''work''':
  
<pre>
+
-rw-r--r--  1 grog  lemis        0 Jul 28 12:34 .build_done.hugin._usr_local
#if defined __FreeBSD__
+
-rw-r--r--  1 grog  lemis        0 Jul 28 12:00 .configure_done.hugin._usr_local
#define log2(x) (log(x) / log(2))
+
-rw-r--r--  1 grog  lemis        0 Jul 25 10:59 .extract_done.hugin._usr_local
#endif
+
-rw-r--r--  1 grog  lemis        0 Jul 25 10:59 .patch_done.hugin._usr_local
</pre>
+
  
?
+
These are used by the Makefile to know which steps need to be repeated.  In particular, the last two are important: if they're missing, the build directory will be removed and replaced by the release.  That's why you need to do a ''make patch'' early in the above procedure.
  
 +
===Updating the installation===
  
=== patch-src_hugin1_hugin_config_defaults.h ===
+
If you find you need to change something after building or installing (either because of an update or a local bug fix), '''don't''' run ''make clean''. That would remove the entire work tree, including the sources.  Instead, remove the files '''work/.build_done.hugin._usr_local''' and  '''work/.install_done.hugin._usr_local''', make the changes, and run ''make install'' again.
 
+
this one looks outdated to me? Autopano-SIFT-C is now in the ports collection:
+
 
+
http://www.freebsd.org/cgi/cvsweb.cgi/ports/graphics/autopano-sift-c/
+
+
the "best practice" in the Hugin project is now to give users a choice of different CP generations. Panomatic is already in the Makefile of the Hugin port, and we now have also match-n-shift and a few other variations and more is expected in the future - each with its own specific settings.
+
 
+
how would be the best way to approach this? should I submit a patch for the ports makefile with
+
 
+
<pre>
+
.if defined(WITH_AUTOPANOSIFT-C)
+
RUN_DEPENDS+= autopanog:${PORTSDIR}/graphics/autopano-sift-c
+
.endif
+
</pre>
+
  
?
+
To synchronize with the repository, do:
  
and what would be the optimal way to set different defaults for the different choices inside the above conditional expression? multiple patch-src_hugin1_hugin_config_defaults.h ? I don't think so but I'm not sure.
+
cd /usr/ports/graphics/hugin-devel/work/hugin-2011.4.0
 +
hg up                                        ''update to the latest version
  
I've added Bruno Postle to this mail. My goal is to streamline the process of getting the latest Hugin and related tools into FreeBSD. We'll have more frequent releases in the foreseeable future and the more we can simplify and automate, the better.
+
To get a specific version,
  
thank you for your efforts.
+
hg up -r 5345                                ''update to version 5345
  
 
[[Category:Software:Hugin]]
 
[[Category:Software:Hugin]]
 
[[Category:Software:Hugin:Compiling]]
 
[[Category:Software:Hugin:Compiling]]

Revision as of 01:18, 8 July 2012

Hugin is part of the FreeBSD ports collection. Using the ports collection (and contributing fixes to it) is the recommended way to install Hugin on FreeBSD. The Hugin port is currently maintained by Vasil Dimov <vd (at) FreeBSD.org>.

Install with the port

# su
# cd /usr/ports/graphics/hugin
# make
# make install

Update the port

To track Hugin's releases, after each new release edit the following files in the Ports Collection:

1. Create a directory /usr/ports/graphics/hugin-new with the same contents as /usr/ports/graphics/hugin. Copy the files Makefile, pkg-descr and pkg-plist from /usr/ports/graphics/hugin to /usr/ports/graphics/hugin-new

2. Edit the Makefile:

  • Set PORTVERSION to the name of the new release (e.g. 2011.2.0).
  • Set PORTREVISION to 0
  • Change any necessary build dependencies in LIB_DEPENDS
  • Change any necessary runtime dependencies in RUN_DEPENDS
  • Change any necessary Cmake building arguments in CMAKE_ARGS

3. Run make makesum to create the file distinfo.

4. Check the pkg-plist list of installed files and change if necessary. While it can't be done automatically, the trick is to make PREFIX=/tmp/foobar install and then check the files under /tmp/foobar (assuming it was non-existent before).

5. Probably not necessary: edit the pkg-descr description of Hugin.

6. Build and confirm that it works.

7. Make a diff and submit it to the FreeBSD maintainer (see at top).

If you would like to know more about porting software to FreeBSD see the FreeBSD Porter's Handbook.

Development versions

The FreeBSD Ports Collection expects to get the software in the form of a tarball. When using software checked out of the Mercurial repository, you will need to do some trickery.

One method is to check out the version and then create a tarball for the Ports Collection to use, but it's easier to first check out a released version (for example the latest release) and then replace it with the version from the repository. The following example assumes that the current release is version 2011.4.0:

CARE: The code below was wrong, and would have removed everything. I have modified it so it's not so dangerous, but it's still wrong. Watch this space.

mkdir -p /usr/ports/graphics/hugin-devel
cd /usr/ports/graphics/hugin                  note: the release directory
cp -p Makefile pkg-descr pkg-plist distinfo ../hugin-devel
cd ../hugin-devel
make patch                                    extracts the tarball
cd work
mv hugin-2011.4.0 hugin-2011.4.0-old          we currently need this: see below
hg clone http://hugin.hg.sourceforge.net:8000/hgroot/hugin/hugin  check out the tip
mv hugin hugin-2011.4.0                       this is the name referred to the Makefile

At this point you currently need to patch the tree. The tclap library that used to be in Hugin has been removed, and until we decide what to do with the FreeBSD build, it will need to be replaced:

mkdir hugin-2011.4.0/src/foreign/tclap
cp -p hugin-2011.4.0-old/src/foreign/tclap/* hugin-2011.4.0/src/foreign/tclap

After this, you can build the version. Change to the FreeBSD build directory, edit Makefile if necessary, and build. If you already have an installed version which you want to keep, you can make a backup of it (second line below):

cd /usr/ports/graphics/hugin-devel
pkg_create -b /var/db/pkg/hugin-2011.4.0          this usage allows file name completion
make install

Note that the Ports Collection stores a number of dummy files in the subdirectory work:

-rw-r--r--   1 grog  lemis        0 Jul 28 12:34 .build_done.hugin._usr_local
-rw-r--r--   1 grog  lemis        0 Jul 28 12:00 .configure_done.hugin._usr_local
-rw-r--r--   1 grog  lemis        0 Jul 25 10:59 .extract_done.hugin._usr_local
-rw-r--r--   1 grog  lemis        0 Jul 25 10:59 .patch_done.hugin._usr_local

These are used by the Makefile to know which steps need to be repeated. In particular, the last two are important: if they're missing, the build directory will be removed and replaced by the release. That's why you need to do a make patch early in the above procedure.

Updating the installation

If you find you need to change something after building or installing (either because of an update or a local bug fix), don't run make clean. That would remove the entire work tree, including the sources. Instead, remove the files work/.build_done.hugin._usr_local and work/.install_done.hugin._usr_local, make the changes, and run make install again.

To synchronize with the repository, do:

cd /usr/ports/graphics/hugin-devel/work/hugin-2011.4.0
hg up                                         update to the latest version

To get a specific version,

hg up -r 5345                                 update to version 5345