You are not logged in.

#1 2013-05-25 12:19:11

mthinkcpp
Member
Registered: 2013-05-11
Posts: 23

[FINISHED] libc++ PKGBUILD review

I have a package called libc++ on the AUR at the moment and it works (except for the unresolvable bug mentioned in the comments, which is resolved in the PKGBUILD following). For version 3.3 which is the first version which properly supports Linux you have to specify the gcc include directories, as I have, I want to check that the format for the PKGBUILD is correct and that there are no glaring flaws (the way I get the gcc directories was the only way I could work out how to do so via a script).

# Maintainer: MThinkCpp <mtc.maintainer[at]outlook.com>
pkgname='libc++'
pkgver=3.3
pkgrel=1
pkgdesc='C++ Standard Library implementation - libc++ is a new implementation of the C++ standard library, targeting C++11.'
url='http://libcxx.llvm.org'
license=('custom: University of Illinois "BSD-Like"')
arch=('any')

depends=('gcc-libs>=4.8') ##gcc-libs for libsupc++ binary
make_depends=('clang>=3.2 : To compile libc++' 'subversion: Download source files' 'cmake: Build toolchain for LLVM' 'gcc: For libsupc++ headers')

prepare() {
  echo "SVN checkout of ${pkgname} version ${pkgver} commencing"
  svn co http://llvm.org/svn/llvm-project/libcxx/branches/release_33 ${srcdir}/libc++ #Download the libc++ sources
  echo "SVN checkout complete"
}
build() {
#get gcc libsupc++ include directories (and save to variables)
  echo "Acquiring gcc include directories (a.k.a. libsupc++ include dirs)"
  cd /usr/include/c++/*.*
  _gcc_include_dir=${PWD}
  cd ./*linux-gnu*
  _gcc_platform_include_dir=${PWD}
  cd ${srcdir}
#Build libc++ (see http://libcxx.llvm.org for more detail on the instructions)
  echo "Building ${pkgname} with clang++"
  CC=clang CXX=clang++ cmake -G "Unix Makefiles" -DLIBCXX_CXX_ABI=libsupc++ -DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="${_gcc_include_dir};${_gcc_platform_include_dir}"\
			     -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${pkgdir}/usr ${srcdir}/libc++
  make
}
package() {
#license
  mkdir -p $pkgdir/usr/share/licenses/$pkgname
  cp ${srcdir}/libc++/LICENSE.TXT $pkgdir/usr/share/licenses/$pkgname/
#install
  echo "Installing ${pkgname}"
  make install
}

Last edited by mthinkcpp (2013-06-15 12:15:56)

Offline

#2 2013-05-25 13:12:45

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,443

Re: [FINISHED] libc++ PKGBUILD review

1. Don't do the svn checkout yourself. Check this page: https://wiki.archlinux.org/index.php/VC … Guidelines

2. $pkgdir is not well defined in the build function. Try '-DCMAKE_INSTALL_PREFIX=/usr', then in the package function use 'make DESTDIR="$pkgdir" install'

3. You should quote all paths which include variables

4. As far as I can see, you're building inside $srcdir instead of the subfolder libc++. Why?

5. I would suggest using gcc -dumpversion and gcc -dumpmachine to build the variables instead of using globs. Something like:

_gcc_include_dir=/usr/include/c++/$(gcc -dumpversion)
_gcc_platform_include_dir=${_gcc_include_dir}/$(gcc -dumpmachine)

This should work even if there's old versions of gcc installed.

Last edited by Scimmia (2013-05-25 13:35:35)

Online

#3 2013-05-25 13:52:33

mthinkcpp
Member
Registered: 2013-05-11
Posts: 23

Re: [FINISHED] libc++ PKGBUILD review

@Scimmia
   1. Okay, I now have the svn check done automatically.

   2. Resolved

   3. Resolved

   4. There is some test inside the CMake files that requires that the build is done outside of the directory that contains the source

CMake Error at cmake/Modules/MacroEnsureOutOfSourceBuild.cmake:7 (message):
  libcxx requires an out of source build.  Please create a separate

   5. Yes that is a much better solution to getting the gcc dirs than what I was using, I've now set the package to use that.

And the new package

# Maintainer: MThinkCpp <mtc.maintainer[at]outlook.com>
pkgname='libc++'
pkgver=3.3
pkgrel=1
pkgdesc='C++ Standard Library implementation - libc++ is a new implementation of the C++ standard library, targeting C++11.'
url='http://libcxx.llvm.org'
license=('custom: University of Illinois "BSD-Like"')
arch=('any')

depends=('gcc-libs>=4.8') ##gcc-libs for libsupc++ binary
make_depends=('clang>=3.2 : To compile libc++' 'subversion: Download source files' 'cmake: Build toolchain for LLVM' 'gcc: For libsupc++ headers')

_svn_repo_branch=release_33 #Needs to be the same as the branch name
source=('svn+http://llvm.org/svn/llvm-project/libcxx/branches/release_33')
md5sums=('SKIP')

build() {
#get gcc libsupc++ include directories (and save to variables)
  echo "Acquiring gcc include directories (a.k.a. libsupc++ include dirs)"
  _gcc_include_dir=/usr/include/c++/$(gcc -dumpversion)
  _gcc_platform_include_dir=${_gcc_include_dir}/$(gcc -dumpmachine)
  cd "${srcdir}"
#Build libc++ (see http://libcxx.llvm.org for more detail on the instructions)
  echo "Building ${pkgname} with clang++"
  CC=clang CXX=clang++ cmake -G "Unix Makefiles" -DLIBCXX_CXX_ABI=libsupc++ -DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="${_gcc_include_dir};${_gcc_platform_include_dir}"\
			     -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr "${srcdir}/${_svn_repo_branch}"
  make
}
package() {
#license
  mkdir -p "$pkgdir/usr/share/licenses/$pkgname"
  cp "${srcdir}/${_svn_repo_branch}/LICENSE.TXT" "$pkgdir/usr/share/licenses/$pkgname/"
#install
  echo "Installing ${pkgname}"
  make DESTDIR="${pkgdir}" install
}

Is there any way to control what directory the svn checkout checks into, or does it have to be left the the repo/branch name.

Anything else?

Thanks for looking at the PKGBUILD

Offline

#4 2013-05-25 14:08:24

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,443

Re: [FINISHED] libc++ PKGBUILD review

Yes, you can add "<dirname>::" to the beginning of the source entry and it will use whatever dir name you want. Simplest would be to just use $pkgname::

As for #4, in this case it's not all that important, but I would make a separate subdir called "build" inside the source tree and build from there. What you're doing should work fine, but if you later need to add some other source to the pkgbuild, you could run into problems. It's just good practice to keep the files segregated.

I also just noticed that you have arch=('any'). That is used when the final package contains nothing that is architecture specific; scripts, images, etc. If you end up with executable binaries, you need to specify architectures, arch=('i686' 'x86_64') is most common.

Online

#5 2013-05-25 14:23:58

mthinkcpp
Member
Registered: 2013-05-11
Posts: 23

Re: [FINISHED] libc++ PKGBUILD review

I've updated it, however inserting ${pkgname} or $pkgname results in the directory being called the name of the variable rather that libc++. So for now I've inserted libc++ instead.
I've now created a directory called build to do the building of libc++ in.

arch=('any'), I misunderstood what it meant, when build a package I thought it implied that the package could be built to run anywhere, rather than that the result was platform specific.

# Maintainer: MThinkCpp <mtc.maintainer[at]outlook.com>
pkgname='libc++'
pkgver=3.3
pkgrel=1
pkgdesc='C++ Standard Library implementation - libc++ is a new implementation of the C++ standard library, targeting C++11.'
url='http://libcxx.llvm.org'
license=('custom: University of Illinois "BSD-Like"')
arch=('i686' 'x86_64')

depends=('gcc-libs>=4.8') ##gcc-libs for libsupc++ binary
make_depends=('clang>=3.2 : To compile libc++' 'subversion: Download source files' 'cmake: Build toolchain for LLVM' 'gcc: For libsupc++ headers')

_svn_repo_branch=release_33 #Needs to be the same as the branch name
source=('libc++::svn+http://llvm.org/svn/llvm-project/libcxx/branches/release_33')
md5sums=('SKIP')

prepare() {
  mkdir ${srcdir}/build
}
build() {
#get gcc libsupc++ include directories (and save to variables)
  echo "Acquiring gcc include directories (a.k.a. libsupc++ include dirs)"
  _gcc_include_dir=/usr/include/c++/$(gcc -dumpversion)
  _gcc_platform_include_dir=${_gcc_include_dir}/$(gcc -dumpmachine)

#Build libc++ (see http://libcxx.llvm.org for more detail on the instructions)
  echo "Building ${pkgname} with clang++"
  cd "${srcdir}/build"
  CC=clang CXX=clang++ cmake -G "Unix Makefiles" -DLIBCXX_CXX_ABI=libsupc++ -DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="${_gcc_include_dir};${_gcc_platform_include_dir}"\
			     -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr "${srcdir}/${pkgname}"
  make
}
package() {
#license
  mkdir -p "$pkgdir/usr/share/licenses/$pkgname"
  cp "${srcdir}/${pkgname}/LICENSE.TXT" "$pkgdir/usr/share/licenses/$pkgname/"
#install
  echo "Installing ${pkgname}"
  cd "${srcdir}/build"
  make DESTDIR="${pkgdir}" install
}

Thanks again, is the PKGBUILD complete now, or is there a mistake (it builds and the result functions fine on my machine)?

Offline

#6 2013-05-25 14:39:27

mthinkcpp
Member
Registered: 2013-05-11
Posts: 23

Re: [FINISHED] libc++ PKGBUILD review

A quick test shows that variables can only be used inside "", so I have altered the source to do so:

# Maintainer: MThinkCpp <mtc.maintainer[at]outlook.com>
pkgname='libc++'
pkgver=3.3
pkgrel=1
pkgdesc='C++ Standard Library implementation - libc++ is a new implementation of the C++ standard library, targeting C++11.'
url='http://libcxx.llvm.org'
license=('custom: University of Illinois "BSD-Like"')
arch=('i686' 'x86_64')

depends=('gcc-libs>=4.8') ##gcc-libs for libsupc++ binary
make_depends=('clang>=3.2 : To compile libc++' 'subversion: Download source files' 'cmake: Build toolchain for LLVM' 'gcc: For libsupc++ headers')

source=("${pkgname}::svn+http://llvm.org/svn/llvm-project/libcxx/branches/release_33")
md5sums=('SKIP')

prepare() {
  mkdir ${srcdir}/build
}
build() {
#get gcc libsupc++ include directories (and save to variables)
  echo "Acquiring gcc include directories (a.k.a. libsupc++ include dirs)"
  _gcc_include_dir=/usr/include/c++/$(gcc -dumpversion)
  _gcc_platform_include_dir=${_gcc_include_dir}/$(gcc -dumpmachine)

#Build libc++ (see http://libcxx.llvm.org for more detail on the instructions)
  echo "Building ${pkgname} with clang++"
  cd "${srcdir}/build"
  CC=clang CXX=clang++ cmake -G "Unix Makefiles" -DLIBCXX_CXX_ABI=libsupc++ -DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="${_gcc_include_dir};${_gcc_platform_include_dir}"\
			     -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr "${srcdir}/${pkgname}"
  make
}
package() {
#license
  mkdir -p "$pkgdir/usr/share/licenses/$pkgname"
  cp "${srcdir}/${pkgname}/LICENSE.TXT" "$pkgdir/usr/share/licenses/$pkgname/"
#install
  echo "Installing ${pkgname}"
  cd "${srcdir}/build"
  make DESTDIR="${pkgdir}" install
}

The PKGBUILD seems complete now and ready for release when LLVM 3.3 officially releases.

Last edited by mthinkcpp (2013-05-25 14:42:44)

Offline

#7 2013-05-25 14:49:52

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,750
Website

Re: [FINISHED] libc++ PKGBUILD review

"make_depends" should be "makedepends", and you shouldn't have descriptions next to them.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#8 2013-05-25 14:54:37

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,443

Re: [FINISHED] libc++ PKGBUILD review

You misunderstood me a bit on the build dir. I was suggesting $srcdir/$pkgname/build, not $srcdir/build. This keeps everything for the source tree together and separate from any other sources that may be involved. It also gets automatically "cleaned" when makepkg removes $srcdir/$pkgname on each run (it does this for VCS sources), so you're building fresh every time.

Keep in mind, this is just a suggestion, others may disagree with me.

The last thing I hadn't brought up yet is whether the pkgver should be 3.3 or if it should be more detailed than that. If you're pulling directly from svn, you should have a way to differentiate between two builds from different revisions, ie a pkgver function with something like echo "3.3.$(echo svnversion)"

On the other hand, if you're going to change the source to use a release tarball once LLVM 3.3 is released, that's not needed, of course.

Edit, I don't see where llvm provides release tarballs, so I guess you have to pull from SVN. Using svnversion also isn't optimal, since it would increment each time trunk is changed, not just the branch. How about something like this:

pkgver() {
  cd ${srcdir}/${pkgname}
  echo "3.3.$(LC_ALL=C svn info | awk '/Last Changed Rev/ {print $4}')"
}

I'm using something similar in some of my SVN PKGBUILDs.

Last edited by Scimmia (2013-05-25 15:10:40)

Online

#9 2013-05-25 15:12:21

mthinkcpp
Member
Registered: 2013-05-11
Posts: 23

Re: [FINISHED] libc++ PKGBUILD review

@Scimmia
Okay, I've changed it to to ${srcdir}/${pkgname}/build, removes the problem of mkdir build failing on package rebuild (that was a problem for me).

Downloading libc++ seems to always be from svn, I haven't found an official tarball for it. The svn repo freezes after release, meaning that the svnversion number will not need to be used, I just checked previous release repos, they haven't changed since 3.1 and 3.2 were released
@WorMzy
Correction applied (my typo), immediate errors came up about the descriptions, which I then removed.

New PKGBUILD is

# Maintainer: MThinkCpp <mtc.maintainer[at]outlook.com>
pkgname='libc++'
pkgver=3.3
pkgrel=1
pkgdesc='C++ Standard Library implementation - libc++ is a new implementation of the C++ standard library, targeting C++11.'
url='http://libcxx.llvm.org'
license=('custom: University of Illinois "BSD-Like"')
arch=('i686' 'x86_64')

depends=('gcc-libs>=4.8') ##gcc-libs for libsupc++ binary
makedepends=('clang>=3.2' 'subversion' 'cmake' 'gcc') #gcc provides libsupc++ headers

source=("${pkgname}::svn+http://llvm.org/svn/llvm-project/libcxx/branches/release_33")
md5sums=('SKIP')

build() {
#get gcc libsupc++ include directories (and save to variables)
  echo "Acquiring gcc include directories (a.k.a. libsupc++ include dirs)"
  _gcc_include_dir=/usr/include/c++/$(gcc -dumpversion)
  _gcc_platform_include_dir=${_gcc_include_dir}/$(gcc -dumpmachine)

#Build libc++ (see http://libcxx.llvm.org for more detail on the instructions)
  echo "Building ${pkgname} with clang++"
  mkdir ${srcdir}/${pkgname}/build
  cd ${srcdir}/${pkgname}/build
  CC=clang CXX=clang++ cmake -G "Unix Makefiles" -DLIBCXX_CXX_ABI=libsupc++ -DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="${_gcc_include_dir};${_gcc_platform_include_dir}"\
			     -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr "${srcdir}/${pkgname}"
  make
}
package() {
#license
  mkdir -p "$pkgdir/usr/share/licenses/$pkgname"
  cp "${srcdir}/${pkgname}/LICENSE.TXT" "$pkgdir/usr/share/licenses/$pkgname/"
#install
  echo "Installing ${pkgname}"
  cd "${srcdir}/${pkgname}/build"
  make DESTDIR="${pkgdir}" install
}

Last edited by mthinkcpp (2013-05-25 15:16:48)

Offline

#10 2013-05-25 15:18:17

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,443

Re: [FINISHED] libc++ PKGBUILD review

Yeah, if they freeze that branch totally, you're fine.

Giving it a last look, I see one other thing I would change. Use "install -Dm644 <sourcefile> <destfile>" to install the license. This will create the dirs and make sure everything has the right permissions.

Other than that minor suggestion, I don't see anything else. smile We'll see what others find.

Online

#11 2013-05-25 15:34:13

mthinkcpp
Member
Registered: 2013-05-11
Posts: 23

Re: [FINISHED] libc++ PKGBUILD review

@Scimmia
Changed how the license was installed
LLVM provide release tarballs http://www.llvm.org/releases/ for 3.2 http://www.llvm.org/releases/download.html#3.2. It is unclear as to where libc++ is located in the tarballs.

New PKGBUILD:

# Maintainer: MThinkCpp <mtc.maintainer[at]outlook.com>
pkgname='libc++'
pkgver=3.3
pkgrel=1
pkgdesc='C++ Standard Library implementation - libc++ is a new implementation of the C++ standard library, targeting C++11.'
url='http://libcxx.llvm.org'
license=('custom: University of Illinois "BSD-Like"')
arch=('i686' 'x86_64')

depends=('gcc-libs>=4.8') ##gcc-libs for libsupc++ binary
makedepends=('clang>=3.2' 'subversion' 'cmake' 'gcc') #gcc provides libsupc++ headers

source=("${pkgname}::svn+http://llvm.org/svn/llvm-project/libcxx/branches/release_33")
md5sums=('SKIP')

build() {
#get gcc libsupc++ include directories (and save to variables)
  echo "Acquiring gcc include directories (a.k.a. libsupc++ include dirs)"
  _gcc_include_dir=/usr/include/c++/$(gcc -dumpversion)
  _gcc_platform_include_dir=${_gcc_include_dir}/$(gcc -dumpmachine)

#Build libc++ (see http://libcxx.llvm.org for more detail on the instructions)
  echo "Building ${pkgname} with clang++"
  mkdir ${srcdir}/${pkgname}/build
  cd ${srcdir}/${pkgname}/build
  CC=clang CXX=clang++ cmake -G "Unix Makefiles" -DLIBCXX_CXX_ABI=libsupc++ -DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="${_gcc_include_dir};${_gcc_platform_include_dir}"\
			     -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr "${srcdir}/${pkgname}"
  make
}
package() {
#license
  install -Dm644 "${srcdir}/${pkgname}/LICENSE.TXT" "$pkgdir/usr/share/licenses/$pkgname/license.txt"
#install
  echo "Installing ${pkgname}"
  cd "${srcdir}/${pkgname}/build"
  make DESTDIR="${pkgdir}" install
}

Thanks for looking at it. It looks a lot better now smile.

Last edited by mthinkcpp (2013-05-25 15:42:50)

Offline

#12 2013-05-29 16:02:54

mthinkcpp
Member
Registered: 2013-05-11
Posts: 23

Re: [FINISHED] libc++ PKGBUILD review

Update to the package, dependency noted, glibc, you cannot use libc++ without it.

# Maintainer: MThinkCpp <mtc.maintainer[at]outlook.com>
pkgname='libc++'
pkgver=3.3
pkgrel=1
pkgdesc='C++ Standard Library implementation - libc++ is a new implementation of the C++ standard library, targeting C++11.'
url='http://libcxx.llvm.org'
license=('custom: University of Illinois "BSD-Like"')
arch=('i686' 'x86_64')

depends=('glibc' 'gcc-libs>=4.8') ##gcc-libs for libsupc++ binary
makedepends=('clang>=3.2' 'subversion' 'cmake' 'gcc') #gcc provides libsupc++ headers

source=("${pkgname}::svn+http://llvm.org/svn/llvm-project/libcxx/branches/release_33")
md5sums=('SKIP')

build() {
#get gcc libsupc++ include directories (and save to variables)
  echo "Acquiring gcc include directories (a.k.a. libsupc++ include dirs)"
  _gcc_include_dir=/usr/include/c++/$(gcc -dumpversion)
  _gcc_platform_include_dir=${_gcc_include_dir}/$(gcc -dumpmachine)

#Build libc++ (see http://libcxx.llvm.org for more detail on the instructions)
  echo "Building ${pkgname} with clang++"
  mkdir ${srcdir}/${pkgname}/build
  cd ${srcdir}/${pkgname}/build
  CC=clang CXX=clang++ cmake -G "Unix Makefiles" -DLIBCXX_CXX_ABI=libsupc++ -DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="${_gcc_include_dir};${_gcc_platform_include_dir}"\
			     -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr "${srcdir}/${pkgname}"
  make
}
package() {
#license
  install -Dm644 "${srcdir}/${pkgname}/LICENSE.TXT" "$pkgdir/usr/share/licenses/$pkgname/license.txt"
#install
  echo "Installing ${pkgname}"
  cd "${srcdir}/${pkgname}/build"
  make DESTDIR="${pkgdir}" install
}

Offline

#13 2013-05-29 17:25:02

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: [FINISHED] libc++ PKGBUILD review

On a related note, all the prepare, build, package functions begin in "${srcdir}", so it's not needed at the beginning of your cd/mkdir commands (unless you've already cd'd out of the $srcdir--it appears that you haven't).

And, as Scimmia noted earlier, you should really quote all uses of variables (especially in paths). So, when you cd to the build directory, the command would be best as the following (which isn't yet the case in your build function):

cd "${pkgname}/build"

All the best,

-HG

P.S., there's nothing wrong with specifying "${srcdir}", it's just often redundant.

Last edited by HalosGhost (2013-05-29 17:31:54)

Offline

#14 2013-05-29 18:35:55

mthinkcpp
Member
Registered: 2013-05-11
Posts: 23

Re: [FINISHED] libc++ PKGBUILD review

@HalosGhost
Fixed quoting variables, benefits of community review to spot them

# Maintainer: MThinkCpp <mtc.maintainer[at]outlook.com>
pkgname='libc++'
pkgver=3.3
pkgrel=1
pkgdesc='C++ Standard Library implementation - libc++ is a new implementation of the C++ standard library, targeting C++11.'
url='http://libcxx.llvm.org'
license=('custom: University of Illinois "BSD-Like"')
arch=('i686' 'x86_64')

depends=('glibc' 'gcc-libs>=4.8') ##gcc-libs for libsupc++ binary
makedepends=('clang>=3.2' 'subversion' 'cmake' 'gcc') #gcc provides libsupc++ headers

source=("${pkgname}::svn+http://llvm.org/svn/llvm-project/libcxx/branches/release_33")
md5sums=('SKIP')

build() {
#get gcc libsupc++ include directories (and save to variables)
  echo "Acquiring gcc include directories (a.k.a. libsupc++ include dirs)"
  _gcc_include_dir=/usr/include/c++/$(gcc -dumpversion)
  _gcc_platform_include_dir=${_gcc_include_dir}/$(gcc -dumpmachine)

#Build libc++ (see http://libcxx.llvm.org for more detail on the instructions)
  echo "Building ${pkgname} with clang++"
  mkdir "${srcdir}/${pkgname}/build"
  cd "${srcdir}/${pkgname}/build"
  CC=clang CXX=clang++ cmake -G "Unix Makefiles" -DLIBCXX_CXX_ABI=libsupc++ -DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="${_gcc_include_dir};${_gcc_platform_include_dir}"\
			     -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr "${srcdir}/${pkgname}"
  make
}
package() {
#license
  install -Dm644 "${srcdir}/${pkgname}/LICENSE.TXT" "$pkgdir/usr/share/licenses/$pkgname/license.txt"
#install
  echo "Installing ${pkgname}"
  cd "${srcdir}/${pkgname}/build"
  make DESTDIR="${pkgdir}" install
}

Thanks for looking at it.

Offline

#15 2013-05-29 19:22:28

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,443

Re: [FINISHED] libc++ PKGBUILD review

HalosGhost wrote:

On a related note, all the prepare, build, package functions begin in "${srcdir}", so it's not needed at the beginning of your cd/mkdir commands (unless you've already cd'd out of the $srcdir--it appears that you haven't).

Style choice. I always prefer to cd to a full path at the beginning of the functions so I know for sure where I'm at if I'm going to issue command without a full path later. Same way all of those braces around the variable aren't needed, but some people prefer them.

Last edited by Scimmia (2013-05-29 19:23:09)

Online

#16 2013-05-29 19:34:33

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: [FINISHED] libc++ PKGBUILD review

Scimmia wrote:

Style choice. I always prefer to cd to a full path at the beginning of the functions so I know for sure where I'm at if I'm going to issue command without a full path later. Same way all of those braces around the variable aren't needed, but some people prefer them.

They make me feel safe tongue

All the best,

-HG

Offline

#17 2013-05-30 17:37:49

mthinkcpp
Member
Registered: 2013-05-11
Posts: 23

Re: [FINISHED] libc++ PKGBUILD review

HalosGhost wrote:
Scimmia wrote:

Style choice. I always prefer to cd to a full path at the beginning of the functions so I know for sure where I'm at if I'm going to issue command without a full path later. Same way all of those braces around the variable aren't needed, but some people prefer them.

They make me feel safe tongue

All the best,

-HG

I prefer including the cd "${srcdir}", as it makes it explicit to me that I am in the $srcdir. Without it, I have no feeling of security that I am definitely in there.

Last edited by mthinkcpp (2013-05-30 17:38:23)

Offline

#18 2013-06-02 12:46:34

mthinkcpp
Member
Registered: 2013-05-11
Posts: 23

Re: [FINISHED] libc++ PKGBUILD review

I have discovered tarballs for libc++ (currently pre-release). For LLVM 3.3 this is the first time that any tarballs have been provided for libc++. You can find them at http://http://llvm.org/pre-releases/3.3/rc2/
I have consequently updated the PKGBUILD to use the tarball (address used will need changing for the final release)

# Maintainer: MThinkCpp <mtc.maintainer[at]outlook.com>
pkgname='libc++'
pkgver=3.3
pkgrel=1
pkgdesc='C++ Standard Library implementation - libc++ is a new implementation of the C++ standard library, targeting C++11.'
url='http://libcxx.llvm.org'
license=('custom: University of Illinois "BSD-Like"')
arch=('i686' 'x86_64')

depends=('glibc' 'gcc-libs>=4.8') ##gcc-libs for libsupc++ binary
makedepends=('clang>=3.2' 'subversion' 'cmake' 'gcc') #gcc provides libsupc++ headers

source=("http://llvm.org/pre-releases/3.3/rc2/libcxx-3.3rc2-source.tar.gz") #Extracts to a folder ${srcdir}/libcxx.src
md5sums=('SKIP')

build() {
#get gcc libsupc++ include directories (and save to variables)
  echo "Acquiring gcc include directories (a.k.a. libsupc++ include dirs)"
  _gcc_include_dir=/usr/include/c++/$(gcc -dumpversion)
  _gcc_platform_include_dir=${_gcc_include_dir}/$(gcc -dumpmachine)

#Build libc++ (see http://libcxx.llvm.org for more detail on the instructions)
  echo "Building ${pkgname} with clang++"
  mkdir "${srcdir}/libcxx.src/build"
  cd "${srcdir}/libcxx.src/build"
  CC=clang CXX=clang++ cmake -G "Unix Makefiles" -DLIBCXX_CXX_ABI=libsupc++ -DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="${_gcc_include_dir};${_gcc_platform_include_dir}"\
			     -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr "${srcdir}/libcxx.src"
  make
}
package() {
#license
  install -Dm644 "${srcdir}/libcxx.src/LICENSE.TXT" "$pkgdir/usr/share/licenses/$pkgname/license.txt"
#install
  echo "Installing ${pkgname}"
  cd "${srcdir}/libcxx.src/build"
  make DESTDIR="${pkgdir}" install
}

Are the modifications okay?

Otherwise thanks for looking at it.

Edit:
For the final release, I suspect (based on looking at the clang tarball format changes between pre-release and release) I will have to change the references to libcxx.src to libcxx-${pkgver}.src

Last edited by mthinkcpp (2013-06-02 12:56:55)

Offline

#19 2013-06-02 15:21:07

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: [FINISHED] libc++ PKGBUILD review

If you're switching to a release candidate, the ${pkgver} should include it (i.e., "3.3.rc2"). This also makes it easier to use the pkgver variable in the source array (good practice).

All the best,

-HG

Offline

#20 2013-06-02 15:22:50

Earnestly
Member
Registered: 2011-08-18
Posts: 805

Re: [FINISHED] libc++ PKGBUILD review

You don't need any of those echos.

Offline

#21 2013-06-04 12:18:36

mthinkcpp
Member
Registered: 2013-05-11
Posts: 23

Re: [FINISHED] libc++ PKGBUILD review

@HalosGhost
RC candidate build is temporary, it will be changed to the final release for the release of the PKGBUILD (libc++ 3.3 final hasn't been released yet, scheduled for tomorrow, 5th of June, see release schedule www.llvm.org)
@Kaustic
I personally like being informed of what is happening in the PKGBUILD by the echo[es]

     Edit:
        I'm keeping the echo "Message".

Last edited by mthinkcpp (2013-06-04 14:44:16)

Offline

#22 2013-06-04 12:51:38

Earnestly
Member
Registered: 2011-08-18
Posts: 805

Re: [FINISHED] libc++ PKGBUILD review

mthinkcpp wrote:

I personally like being informed of what is happening in the PKGBUILD by the echo[es]

That's nice, remove them.

If you really want them use msg2 (or msg)

Offline

#23 2013-06-04 14:51:28

mthinkcpp
Member
Registered: 2013-05-11
Posts: 23

Re: [FINISHED] libc++ PKGBUILD review

@Kaustic
I'm keeping the echo[es]. I may not need them, but I am still keeping them.

Last edited by mthinkcpp (2013-06-04 14:52:20)

Offline

#24 2013-06-04 15:35:37

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,728

Re: [FINISHED] libc++ PKGBUILD review

mthinkcpp wrote:

I'm keeping the echo[es]. I may not need them, but I am still keeping them.

Well, I looked around the guidelines and did not see anything that discourages noise created by all those echos, but... It is always been the Unix 'style' for programs to be as quiet as possible and only create commentary when something goes awry.  Kaustic, have you a link that I may have missed?  Also, where is msg2 documented?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Online

#25 2013-06-04 16:40:04

Earnestly
Member
Registered: 2011-08-18
Posts: 805

Re: [FINISHED] libc++ PKGBUILD review

ewaller wrote:

Also, where is msg2 documented?

vi /usr/bin/makepkg, line 108. It keeps things more consistent. Personally I think using any form of print statement for anything other than debugging is simply additional noise. It's sad to see package maintainers (typically only in the AUR) do it although it's not a big deal. Shrug.

Last edited by Earnestly (2013-06-04 16:40:25)

Offline

Board footer

Powered by FluxBB