Björn,
Thank you so much, that was it.
and now:

rpm -pql /home/kahmed/rpmbuild/RPMS/i386/pcore-0.1-Beta.i386.rpm
/usr/bin/ggsnc
/usr/share/doc/pcore-0.1
/usr/share/doc/pcore-0.1/NEWS
Thanks,
-Kamal.

From: Björn Persson <bjorn@rombobjörn.se>
To: Kamal Ahmed <kamal2222ahmed@yahoo.com>; Discussion of RPM packaging standards and practices for Fedora <packaging@lists.fedoraproject.org>
Sent: Sunday, April 15, 2012 5:59 PM
Subject: what a buildroot is

Kamal Ahmed wrote:
> Name: foo ... BuildRoot: /tmp/%{name} %prep ... %build ... %install install
> -m755 $RPM_BUILD_ROOT/obj/ggsnc/ggsnc %{_bindir}/ %files /usr/bin/ggsnc

I think I see the misunderstanding. Perhaps it will help you if I point out
that "buildroot" is a very badly chosen word. It should have been called
"installroot". The buildroot is not where the build takes place, it's a
staging directory that you install into. That "chroot" or "root simulated
environment" you're asking for, that's what the buildroot is.

In other words, you shouldn't try to copy files *from* the buildroot, you
should copy them *to* the buildroot.

Use these spec file fragments:

# Define a temporary installation root.
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)

%install
# Make an empty installation root.
rm -rf %{buildroot}
mkdir -p %{buildroot}
# Make directories in the installation root.
mkdir -p %{buildroot}%{_bindir}
# Copy files to the installation root.
cp obj/ggsnc/ggsnc %{buildroot}%{_bindir}

%files
%{_bindir}/ggsnc

Be sure to note carefully where I have used "%{buildroot}" in the code above,
and where I have not used it.

(It doesn't matter much whether you use "%{buildroot}" (an RPM macro) or
"$RPM_BUILD_ROOT" (a shell variable). I prefer the RPM macro because I think
it makes the spec file more readable.)


By the way, please don't reply to another message unless the message you're
writing is actually a reply to that message. This thread is shown as replies
to a question from Mihamina Rakotomandimby that it actually has nothing to do
with.

Björn Persson