# [SOLVED] PKGBUILD submarine → ebuild

## tuwox

Witam,

Wczoraj wpadłem na pomysł zainstalowania sobie submarine. 

Konkretniej: przepisania Archowego PKGBUILDA na ebuilda. Zadanie niby proste, jednak wydaje się, że mnie przerosło. Cóż, przyznaję się bez bicia - gentoo mam od kilku dni, więc wszelkie tajniki pisania magicznych ebuildów nie są mi znajome.

PKGBUILDów nie pisałem, więc postanowiłem chociaż trochę poznać ebuildy. Dobra, wszystko fajnie, napisałem, jednak próby kompilacji się nie powiodły. Ba, nawet do niej nie doszło. Zaktualizowałem automake do wersji 1.12.2 w nadziei, że coś jednak ruszy - no, niby zaszło dalej, niż poprzednio. Poniżej widzimy kalekiego ebuilda mojego autorstwa: 

```

# $Header: $

EAPI="4"

DESCRIPTION="Command-line program for searching and downloading the right

subtitles for movies"

HOMEPAGE="http://github.com/blazt/submarine"

SRC_URI="https://github.com/blazt/submarine/tarball/${PV} -> ${P}.tar.gz"

TAG_HASH="49b39de"

S="$WORKDIR/blazt-submarine-$TAG_HASH"

LICENSE="GPL-2"

SLOT="0"

KEYWORDS="~amd64 ~x86"

IUSE="+vala"

RDEPEND="

vala? ( >=dev-lang/vala-0.16.1-r1 )

dev-libs/glib 

app-arch/libarchive 

dev-libs/libgee 

net-libs/libsoup"

DEPEND="${RDEPEND}"

src_prepare() {

sed -i '/AM_SILENT_RULES/ a\AM_PROG_AR' "configure.ac"

}

src_compile() {

   ./autogen.sh

   econf --prefix=/usr \

   emake

}

src_install() {

   emake DESTDIR="${D}" install

}

```

Tak, zamieniłem autoreconf na skrypt upstreamu, bo wtedy w ogóle nie ruszało. 

Jak na razie próba instalacji kończy się następująco: [build.log]

```
[32;01m * [39;49;00mPackage:    media-video/submarine-0.1.3

[32;01m * [39;49;00mRepository: x-portage

[32;01m * [39;49;00mUSE:        amd64 elibc_glibc kernel_linux multilib userland_GNU vala

[32;01m * [39;49;00mFEATURES:   ccache sandbox

>>> Unpacking source...

>>> Unpacking submarine-0.1.3.tar.gz to /var/tmp/portage/media-video/submarine-0.1.3/work

>>> Source unpacked in /var/tmp/portage/media-video/submarine-0.1.3/work

>>> Preparing source in /var/tmp/portage/media-video/submarine-0.1.3/work/blazt-submarine-49b39de ...

>>> Source prepared.

>>> Configuring source in /var/tmp/portage/media-video/submarine-0.1.3/work/blazt-submarine-49b39de ...

>>> Source configured.

>>> Compiling source in /var/tmp/portage/media-video/submarine-0.1.3/work/blazt-submarine-49b39de ...

autoreconf-2.68: Entering directory `.'

autoreconf-2.68: configure.ac: not using Gettext

autoreconf-2.68: running: aclocal -I m4

autoreconf-2.68: configure.ac: tracing

autoreconf-2.68: configure.ac: creating directory build-aux

autoreconf-2.68: running: libtoolize --copy

libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.

libtoolize: copying file `build-aux/ltmain.sh'

libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.

libtoolize: copying file `m4/libtool.m4'

libtoolize: copying file `m4/ltoptions.m4'

libtoolize: copying file `m4/ltsugar.m4'

libtoolize: copying file `m4/ltversion.m4'

libtoolize: copying file `m4/lt~obsolete.m4'

autoreconf-2.68: running: /usr/bin/autoconf-2.68

autoreconf-2.68: running: /usr/bin/autoheader-2.68

autoreconf-2.68: running: automake --add-missing --copy --no-force

configure.ac:8: installing 'build-aux/ar-lib'

configure.ac:19: installing 'build-aux/compile'

configure.ac:16: installing 'build-aux/config.guess'

configure.ac:16: installing 'build-aux/config.sub'

configure.ac:6: installing 'build-aux/install-sh'

configure.ac:6: installing 'build-aux/missing'

lib/Makefile.am: installing 'build-aux/depcomp'

autoreconf-2.68: Leaving directory `.'

 [33;01m*[0m QA Notice: econf called in src_compile instead of src_configure

 * econf: updating blazt-submarine-49b39de/build-aux/config.sub with /usr/share/gnuconfig/config.sub

 * econf: updating blazt-submarine-49b39de/build-aux/config.guess with /usr/share/gnuconfig/config.guess

./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/usr/lib64 --disable-dependency-tracking --prefix=/usr emake

configure: WARNING: you should use --build, --host, --target

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

checking for a thread-safe mkdir -p... /bin/mkdir -p

checking for gawk... gawk

checking whether make sets $(MAKE)... yes

checking whether make supports nested variables... yes

checking for style of include used by make... GNU

checking for x86_64-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc

checking whether the C compiler works... yes

checking for C compiler default output file name... a.out

checking for suffix of executables... 

checking whether we are cross compiling... no

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether x86_64-pc-linux-gnu-gcc accepts -g... yes

checking for x86_64-pc-linux-gnu-gcc option to accept ISO C89... none needed

checking dependency style of x86_64-pc-linux-gnu-gcc... none

checking for x86_64-pc-linux-gnu-ar... x86_64-pc-linux-gnu-ar

checking the archiver (x86_64-pc-linux-gnu-ar) interface... ar

checking for x86_64-pc-linux-gnu-ar... (cached) x86_64-pc-linux-gnu-ar

checking the archiver (x86_64-pc-linux-gnu-ar) interface... (cached) ar

checking build system type... x86_64-pc-linux-gnu

checking host system type... x86_64-pc-linux-gnu

checking how to print strings... printf

checking for a sed that does not truncate output... /bin/sed

checking for grep that handles long lines and -e... /bin/grep

checking for egrep... /bin/grep -E

checking for fgrep... /bin/grep -F

checking for ld used by x86_64-pc-linux-gnu-gcc... /usr/x86_64-pc-linux-gnu/bin/ld

checking if the linker (/usr/x86_64-pc-linux-gnu/bin/ld) is GNU ld... yes

checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B

checking the name lister (/usr/bin/nm -B) interface... BSD nm

checking whether ln -s works... yes

checking the maximum length of command line arguments... 1572864

checking whether the shell understands some XSI constructs... yes

checking whether the shell understands "+="... yes

checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop

checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop

checking for /usr/x86_64-pc-linux-gnu/bin/ld option to reload object files... -r

checking for x86_64-pc-linux-gnu-objdump... x86_64-pc-linux-gnu-objdump

checking how to recognize dependent libraries... pass_all

checking for x86_64-pc-linux-gnu-dlltool... no

checking for dlltool... no

checking how to associate runtime and link libraries... printf %s\n

checking for x86_64-pc-linux-gnu-ar... (cached) x86_64-pc-linux-gnu-ar

checking for archiver @FILE support... @

checking for x86_64-pc-linux-gnu-strip... x86_64-pc-linux-gnu-strip

checking for x86_64-pc-linux-gnu-ranlib... x86_64-pc-linux-gnu-ranlib

checking command to parse /usr/bin/nm -B output from x86_64-pc-linux-gnu-gcc object... ok

checking for sysroot... no

checking for x86_64-pc-linux-gnu-mt... no

checking for mt... no

checking if : is a manifest tool... no

checking how to run the C preprocessor... x86_64-pc-linux-gnu-gcc -E

checking for ANSI C header files... yes

checking for sys/types.h... yes

checking for sys/stat.h... yes

checking for stdlib.h... yes

checking for string.h... yes

checking for memory.h... yes

checking for strings.h... yes

checking for inttypes.h... yes

checking for stdint.h... yes

checking for unistd.h... yes

checking for dlfcn.h... yes

checking for objdir... .libs

checking if x86_64-pc-linux-gnu-gcc supports -fno-rtti -fno-exceptions... no

checking for x86_64-pc-linux-gnu-gcc option to produce PIC... -fPIC -DPIC

checking if x86_64-pc-linux-gnu-gcc PIC flag -fPIC -DPIC works... yes

checking if x86_64-pc-linux-gnu-gcc static flag -static works... yes

checking if x86_64-pc-linux-gnu-gcc supports -c -o file.o... yes

checking if x86_64-pc-linux-gnu-gcc supports -c -o file.o... (cached) yes

checking whether the x86_64-pc-linux-gnu-gcc linker (/usr/x86_64-pc-linux-gnu/bin/ld -m elf_x86_64) supports shared libraries... yes

checking whether -lc should be explicitly linked in... no

checking dynamic linker characteristics... GNU/Linux ld.so

checking how to hardcode library paths into programs... immediate

checking whether stripping libraries is possible... yes

checking if libtool supports shared libraries... yes

checking whether to build shared libraries... yes

checking whether to build static libraries... yes

checking for x86_64-pc-linux-gnu-gcc... (cached) x86_64-pc-linux-gnu-gcc

checking whether we are using the GNU C compiler... (cached) yes

checking whether x86_64-pc-linux-gnu-gcc accepts -g... (cached) yes

checking for x86_64-pc-linux-gnu-gcc option to accept ISO C89... (cached) none needed

checking dependency style of x86_64-pc-linux-gnu-gcc... (cached) none

checking whether x86_64-pc-linux-gnu-gcc and cc understand -c and -o together... yes

checking for valac... no

configure: WARNING: No Vala compiler found.  You will not be able to compile .vala source files.

checking for x86_64-pc-linux-gnu-pkg-config... no

checking for pkg-config... /usr/bin/pkg-config

checking pkg-config is at least version 0.9.0... yes

checking for LIBSUBMARINE... yes

checking for SUBMARINE... yes

checking that generated files are newer than configure... done

configure: creating ./config.status

config.status: creating Makefile

config.status: creating lib/Makefile

config.status: creating submarine/Makefile

config.status: creating doc/Makefile

config.status: creating config.h

config.status: executing depfiles commands

config.status: executing libtool commands

>>> Source compiled.

>>> Test phase [not enabled]: media-video/submarine-0.1.3

>>> Install submarine-0.1.3 into /var/tmp/portage/media-video/submarine-0.1.3/image/ category media-video

make -j3 DESTDIR=/var/tmp/portage/media-video/submarine-0.1.3/image/ install 

Making install in lib

make[1]: Entering directory `/var/tmp/portage/media-video/submarine-0.1.3/work/blazt-submarine-49b39de/lib'

  VALAC    libsubmarine_la_vala.stamp

/bin/sh: --pkg: command not found

make[1]: *** [libsubmarine_la_vala.stamp] Error 127

make[1]: Leaving directory `/var/tmp/portage/media-video/submarine-0.1.3/work/blazt-submarine-49b39de/lib'

make: *** [install-recursive] Error 1

 [31;01m*[0m ERROR: media-video/submarine-0.1.3 failed (install phase):

 [31;01m*[0m   emake failed

 [31;01m*[0m 

 [31;01m*[0m If you need support, post the output of `emerge --info '=media-video/submarine-0.1.3'`,

 [31;01m*[0m the complete build log and the output of `emerge -pqv '=media-video/submarine-0.1.3'`.

 [31;01m*[0m This ebuild is from an overlay named 'x-portage': '/usr/local/portage/'

 [31;01m*[0m The complete build log is located at '/var/tmp/portage/media-video/submarine-0.1.3/temp/build.log'.

 [31;01m*[0m The ebuild environment file is located at '/var/tmp/portage/media-video/submarine-0.1.3/temp/environment'.

 [31;01m*[0m Working directory: '/var/tmp/portage/media-video/submarine-0.1.3/work/blazt-submarine-49b39de'

 [31;01m*[0m S: '/var/tmp/portage/media-video/submarine-0.1.3/work/blazt-submarine-49b39de'

```

Z góry dzięki za wszelkie rady prowadzące do rozwiązania mojego arcytrudnego problemu  :Wink: Last edited by tuwox on Tue Aug 07, 2012 7:54 pm; edited 1 time in total

----------

## SlashBeast

src_install i src_compile wyrzucil bym calkiem, dodal bym src_prepare i tam wrzucil 'eautoreconf' (najpierw 'inherit autotools') i wtedy sprawdz. Ten blad sugeruje, ze ktos dal ciala piszac skrypt instalacyjny, jest duza szansa, ze eautoreconf przebuduje go tak, by dzialal.

----------

## tuwox

Dodałem wg. zaleceń (albo coś zepsułem po drodze): 

```
src_prepare() {

sed -i '/AM_SILENT_RULES/ a\AM_PROG_AR' "configure.ac"

inherit autotools

eautoreconf

emake

}

```

Wywala się tak: 

```
[32;01m * [39;49;00mPackage:    media-video/submarine-0.1.3

[32;01m * [39;49;00mRepository: x-portage

[32;01m * [39;49;00mUSE:        amd64 elibc_glibc kernel_linux multilib userland_GNU vala

[32;01m * [39;49;00mFEATURES:   ccache sandbox

>>> Unpacking source...

>>> Unpacking submarine-0.1.3.tar.gz to /var/tmp/portage/media-video/submarine-0.1.3/work

>>> Source unpacked in /var/tmp/portage/media-video/submarine-0.1.3/work

>>> Preparing source in /var/tmp/portage/media-video/submarine-0.1.3/work/blazt-submarine-49b39de ...

 [33;01m*[0m QA Notice: ECLASS 'autotools' inherited illegally in media-video/submarine-0.1.3 prepare

/usr/lib64/portage/bin/ebuild.sh: line 279: unset: IUSE: cannot unset: readonly variable

/usr/lib64/portage/bin/ebuild.sh: line 279: unset: REQUIRED_USE: cannot unset: readonly variable

/usr/lib64/portage/bin/ebuild.sh: line 279: unset: DEPEND: cannot unset: readonly variable

/usr/lib64/portage/bin/ebuild.sh: line 279: unset: RDEPEND: cannot unset: readonly variable

/usr/lib64/portage/bin/ebuild.sh: line 279: unset: PDEPEND: cannot unset: readonly variable

 [33;01m*[0m QA Notice: ECLASS 'libtool' inherited illegally in media-video/submarine-0.1.3 prepare

/usr/lib64/portage/bin/ebuild.sh: line 279: unset: IUSE: cannot unset: readonly variable

/usr/lib64/portage/bin/ebuild.sh: line 279: unset: REQUIRED_USE: cannot unset: readonly variable

/usr/lib64/portage/bin/ebuild.sh: line 279: unset: DEPEND: cannot unset: readonly variable

/usr/lib64/portage/bin/ebuild.sh: line 279: unset: RDEPEND: cannot unset: readonly variable

/usr/lib64/portage/bin/ebuild.sh: line 279: unset: PDEPEND: cannot unset: readonly variable

/usr/portage/eclass/libtool.eclass: line 33: DESCRIPTION: readonly variable

[31;01m * [39;49;00mThe ebuild phase 'prepare' has exited unexpectedly. This type of

[31;01m * [39;49;00mbehavior is known to be triggered by things such as failed variable

[31;01m * [39;49;00massignments (bug #190128) or bad substitution errors (bug #200313).

[31;01m * [39;49;00mNormally, before exiting, bash should have displayed an error message

[31;01m * [39;49;00mabove. If bash did not produce an error message above, it's possible

[31;01m * [39;49;00mthat the ebuild has called `exit` when it should have called `die`

[31;01m * [39;49;00minstead. This behavior may also be triggered by a corrupt bash binary or

[31;01m * [39;49;00ma hardware problem such as memory or cpu malfunction. If the problem is

[31;01m * [39;49;00mnot reproducible or it appears to occur randomly, then it is likely to

[31;01m * [39;49;00mbe triggered by a hardware problem. If you suspect a hardware problem

[31;01m * [39;49;00mthen you should try some basic hardware diagnostics such as memtest.

[31;01m * [39;49;00mPlease do not report this as a bug unless it is consistently

[31;01m * [39;49;00mreproducible and you are sure that your bash binary and hardware are

[31;01m * [39;49;00mfunctioning properly.

```

Przenosząc "inherit autotools" pod EAPI, build.log wygląda tak: 

```
[32;01m * [39;49;00mPackage:    media-video/submarine-0.1.3

[32;01m * [39;49;00mRepository: x-portage

[32;01m * [39;49;00mUSE:        amd64 elibc_glibc kernel_linux multilib userland_GNU vala

[32;01m * [39;49;00mFEATURES:   ccache sandbox

>>> Unpacking source...

>>> Unpacking submarine-0.1.3.tar.gz to /var/tmp/portage/media-video/submarine-0.1.3/work

>>> Source unpacked in /var/tmp/portage/media-video/submarine-0.1.3/work

>>> Preparing source in /var/tmp/portage/media-video/submarine-0.1.3/work/blazt-submarine-49b39de ...

 [32;01m*[0m Running eautoreconf in '/var/tmp/portage/media-video/submarine-0.1.3/work/blazt-submarine-49b39de' ...

 [32;01m*[0m Running libtoolize --install --copy --force --automake ...

[A[77C [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m Running aclocal -I m4 ...

[A[77C [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m Running autoconf ...

[A[77C [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m Running autoheader ...

[A[77C [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m Running automake --add-missing --copy --foreign ...

[A[77C [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m Running elibtoolize in: blazt-submarine-49b39de/build-aux/

 [32;01m*[0m   Applying portage/1.2.0 patch ...

 [32;01m*[0m   Applying sed/1.5.6 patch ...

 [32;01m*[0m   Applying as-needed/2.2.6 patch ...

make -j3 

make: *** No targets specified and no makefile found.  Stop.

 [31;01m*[0m ERROR: media-video/submarine-0.1.3 failed (prepare phase):

 [31;01m*[0m   emake failed

 [31;01m*[0m 

 [31;01m*[0m If you need support, post the output of `emerge --info '=media-video/submarine-0.1.3'`,

 [31;01m*[0m the complete build log and the output of `emerge -pqv '=media-video/submarine-0.1.3'`.

 [31;01m*[0m This ebuild is from an overlay named 'x-portage': '/usr/local/portage/'

 [31;01m*[0m The complete build log is located at '/var/tmp/portage/media-video/submarine-0.1.3/temp/build.log'.

 [31;01m*[0m The ebuild environment file is located at '/var/tmp/portage/media-video/submarine-0.1.3/temp/environment'.

 [31;01m*[0m Working directory: '/var/tmp/portage/media-video/submarine-0.1.3/work/blazt-submarine-49b39de'

 [31;01m*[0m S: '/var/tmp/portage/media-video/submarine-0.1.3/work/blazt-submarine-49b39de'

```

----------

## SlashBeast

Chodzilo mi raczej o cos takiego:

```
# $Header: $

EAPI="4"

inherit autotools

DESCRIPTION="Command-line program for searching and downloading the right subtitles for movies"

HOMEPAGE="http://github.com/blazt/submarine"

SRC_URI="https://github.com/blazt/submarine/tarball/${PV} -> ${P}.tar.gz"

TAG_HASH="49b39de"

S="$WORKDIR/blazt-submarine-$TAG_HASH"

LICENSE="GPL-2"

SLOT="0"

KEYWORDS="~amd64 ~x86"

IUSE="+vala"

RDEPEND="

    vala? ( >=dev-lang/vala-0.16.1-r1 )

    dev-libs/glib

    app-arch/libarchive

    dev-libs/libgee

    net-libs/libsoup"

DEPEND="${RDEPEND}"

src_prepare() {

    sed -i '/AM_SILENT_RULES/ a\AM_PROG_AR' "configure.ac"

    eautoreconf

}
```

Nie ma potrzeby dodawania emake, jak nie wtawiasz src_compile to z automatu wskoczy.

----------

## tuwox

Problem jednak nie leży w samym ebuildzie. W pewnym momencie build.log wypluło, że nie ma vali 

```
checking for valac... no
```

 Z ciekawości odpaliłem ./configure, uprzednio linkując /usr/bin/vala-0.16 do /usr/bin/valac - przeszło. Poprawka powinna dotyczyć ebuilda vala. Widzę, że nawet chłopcy od vali na to wpadli, ale nie wymusili swoich poprawek w Gentoo.

EDIT: Wstawiłem export VALAC do valac-0.16, czego efektem jest udana kompilacja!

Tak czy siak, dzięki @SlashBeast.

----------

