[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anteriorRevisión previa
Próxima revisión
Revisión previa
es:howtos:misc:anatomy_of_a_slackbuild [2020/01/24 14:40 (UTC)] – [Anatomía de un Slackbuild] rrampes:howtos:misc:anatomy_of_a_slackbuild [2020/04/26 20:17 (UTC)] (actual) – Traducción completa. Comentarios y sugerencias son bienvenidos rramp
Línea 1: Línea 1:
 <!-- Add your text below. We strongly advise to start with a Headline (see button bar above). --> <!-- Add your text below. We strongly advise to start with a Headline (see button bar above). -->
  
-<note>En proceso de traducción.  --- //[[wiki:user:rramp|rramp]] 2020/01/13 16:26 (UTC)//</note> 
 ====== Anatomía de un Slackbuild ====== ====== Anatomía de un Slackbuild ======
  
Línea 35: Línea 34:
  
 En los días anteriores a Windows en Unix, un shell o Bourne Shell (Stephen Bourne, Bell Labs) fue una forma de comunicarse con el sistema. En los días anteriores a Windows en Unix, un shell o Bourne Shell (Stephen Bourne, Bell Labs) fue una forma de comunicarse con el sistema.
-En reconocimiento a Stephen Bourne, Brian Fox lanzó una nueva versi{on en 1989 y la llamó *B**ourne **a**gain **Sh**ell (bash).+En reconocimiento a Stephen Bourne, Brian Fox lanzó una nueva versión en 1989 y la llamó *B**ourne **a**gain **Sh**ell (bash).
  
 Si abrís una terminal en Slackware - es decir ''Menu -> System -> Console'' y tipeando en el $ prompt: Si abrís una terminal en Slackware - es decir ''Menu -> System -> Console'' y tipeando en el $ prompt:
Línea 133: Línea 132:
  
 Otro algoritmo común es llamado, por ejemplo, php es la "sentencia switch". Otro algoritmo común es llamado, por ejemplo, php es la "sentencia switch".
-En terminos simples, es una lista con condiciones que se va evaluando. Si ninguna de las condiciones se cumple en las últimas líneas puede colocar lo que le gustaría hacer.+En términos simples, es una lista con condiciones que se va evaluando. Si ninguna de las condiciones se cumple en las últimas líneas puede colocar lo que le gustaría hacer.
  
-En bash  +En bash en principio es la misma idea, pero se le llama "sentencia case" 
- +Podes colocar lo que desees en los bloques case, pero si piensas en el hecho de que queremos averiguar la "arquitecturade un ordenador y ya sabemos que sólo hay ciertas posibilidades, entonces tiene sentido probar primero un par de posibilidades conocidas en la lista y, si no hay ninguna coincidencia, hacer algo para obtener una respuesta. arm i586 son dos tipos de arquitecturas de computadoras.
-In bash its in principle the same idea but its referred to as "case statement" .In principle you can put anything you like in the case blockbut if you think about the fact we want to find out the "architectureof a computer and already know there are only certain possibilities then it makes sense to try out a couple of known possibilities in the list first and if there is no match do something to get an answer. arm and i586 are of course two types of computer architecture.+
  
 Ahora, si pruebas este código en una ventana de terminal: Ahora, si pruebas este código en una ventana de terminal:
Línea 147: Línea 145:
 Esto muestra la arquitectura de tu PC, en mi caso es x86_64. Esto muestra la arquitectura de tu PC, en mi caso es x86_64.
  
-So to summarize regarding the block of codeFirst an "if" statement is run to see if the variable "ARCH" is emptyIf there is a value for the ARCH variable nothing in the block of  the "if" and inner "case" will run;but  if an empty string is found (ARCH has no value "case statementis run(within the if block of code to find a match.If a match was found the variable ARCH would be set to the value of the match found, and the execution of the case would come to a stop If the ARCH variable was empty and  no match was found in the case list then the bottom line comes int play which is:+Así que para resumir con respecto al bloque de códigoPrimero una sentencia "if" se ejecuta para ver si la variable "ARCH" está vacíaSi hay un valor para la variable ARCH, nada en el bloque de "if" "case" interno se ejecutarápero si una cadena vacía es encontrada (ARCH no tiene valoruna "sentencia case" es ejecutada (dentro del bloque de código if) para buscar una coincidenciaSi se encuentra una coincidencia la variable ARCH sera asignada con el valor de la coincidencia y la ejecución del case se detendríaSi la variable ARCH estaba vacía y no coincide con la listaentonces entra en juego la línea que dice: 
 + 
 +<code>uname -m </code> 
 +es usado para obtener el resultado y la variable ARCH es fijada con el resultado.
  
-<code>uname -m </code> is used to get a result and ARCH set to the result.  +No te preocupes por el signo de interrogación en i?86, el signo de interrogación es un lugar que permite posibilidades través de regex. 
-   +Podría ser "3" (i386), "6"( i686)etc.
-   +
-Don't be   fazed by the question mark in i?86 ,the question mark is place holder that allows for possibilities via regex. it could be "3" (i386) , "6"( i686) etc.+
  
-Next block of code+Próximo bloque de código
  
 <code> <code>
Línea 163: Línea 162:
 </code> </code>
  
-Before we go into this let me have look in my slackware file  system and see whats there at /tmp/SBo.Taking quick look at the image will give you a clue that the slackbuild worksby using the /tmp/SBo/ directory and creates a directory with the syntax package-packagename.So if we now have a look at the code above. CWD (current working directory is a  variable and is set to the value of pwd. If you run that in a terminal windowit will tell you where you in a bash context where you are working from.{{ howtos:misc:tmp_Sbo.gif }}+Antes de entrar en esto, déjame echar un vistazo mi sistema de archivos de Slackware y ver qué hay en /tmp/SBo.  
 +Echando un vistazo rápido la imagen te dará una pista de que el slackbuild funcionausando el directorio /tmp/SBo/ y crea un directorio con la sintaxis package-packagename. Así que si ahora echamos un vistazo al código anterior. 
 +CWD (directorio de trabajo actuales una variable y es configurada al valor de pwd. Si lo ejecutas en una ventana del terminal, te dirá dónde estás en un contexto bash desde el que estás trabajando. 
 +{{ howtos:misc:tmp_Sbo.gif }}
  
-TMP is going to be set to /tmp/SBo. +TMP se va a establecer en /tmp/SBo. 
-Now lets have look at +Ahora echemos un vistazo 
  
 <code> <code>
 PKG=$TMP/package-$PRGNAM PKG=$TMP/package-$PRGNAM
 </code> </code>
-   + 
-You might guess PKG is going to be set for latex2html to :+Se podría suponer que la PKG se va a fijar para el látex2html a 
 <code> <code>
 /tmp/SBo/package-latex2html /tmp/SBo/package-latex2html
 </code> </code>
  
-If you look closely at the image (taking into account /tmp/SBo/ at top of image you will see exactly that in the image.OUTPUT is set to  /tmp \\+Si se mira de cerca la imagen (tomando en cuenta /tmp/SBo/ en la parte superior de la imagenverás exactamente que en la imagen. OUTPUT está ajustado a /tmp\\
  
-Next block of code:+Próximo bloque de código:
 <code> <code>
 if [ "$ARCH" = "i586" ]; then if [ "$ARCH" = "i586" ]; then
Línea 196: Línea 199:
  
 </code> </code>
-Probably we needbefore we look at the rest of the code for  latex2html slackbuild to introduce  some basic concepts.+Probablementeantes de mirar el resto del código del slackbuild latex2html para introducir necesitemos algunos conceptos básicos.
  
-Historically computer software is installed  in  a three step process  called configure, makemake install. Configure gets ready to build the software , see if everything needed is there and builds a new make filemake file is a file that contains instructions to build a program+Históricamente el software para computadoras es instalado en un un proceso de tres pasos llamado configure, make and make install. 
 +configure se utiliza para preparar la construcción del software, comprueba que todo lo necesario está en el sistema y crea un archivo para make. Un archivo para make es un archivo que contiene instrucciones para compilar un programa.
  
-You can from the command line install software just using configure, make and make install. slackbuild does the job of creating a package so that the process of installing is more manageable and reliable fashionWhen you have a slackbuild downloaded on your system should there be a new release of source code its a simple matter of putting  that source in your unpacked slackbuild and a quick edit to the slackbuild script+A partir de la línea de comandos se puede instalar software solamente usando configure, make and make install. Un slackbuild hace el trabajo de crear el paquete para que el proceso de instalación sea más manejable y confiable de modaCuando usted tiene un slackbuild descargado en su sistema, si hay una nueva versión del código fuente es una simple cuestión de poner esa fuente en su slackbuild desempaquetado y una rápida edición del script de slackbuild. 
  
 +El código fuente de los programas informáticos está escrito en lenguajes de "alto nivel", pero se convierte en una forma que el ordenador puede entender fácilmente. El código escrito en el lenguaje C implica que un compilador de C lo convierte a binario.
  
-Computer program source  are written in “high level “ languages but are converted into form that the computer can readily understand.Code written in the C language involves C compiler converted it to binary.+El objetivo de cualquier sistema que instale un programa, es que debe implicar el concepto de hacerlo "la medida" del ordenador que se está instalandoObviamente eso va implicar la arquitectura del ordenador.  
 +Durante el proceso de compilación el sistema puede ser ajustado pasando opciones de variables.
  
-The whole goal of any system  installing a programis that it should involve the concept of making it “tailor made” for the computer its being installedObviously that is going to involve the computer Architecture +Así que ahora echemos un vistazo al bloque de código de arriba. El bloque de código es simplemente un "bloque de ifelse", donde el código se ejecuta de arriba a abajo y asciende a -si la arquitectura es i586 pongan SLKFLAGS a .. si no vayan a la siguiente línea.
-During the compile process the system can be tweaked by passing in options from variables+
  
-So lets now have a look at the block of code aboveThe block of code is simply an "if , else block" , where the code is executed top to bottom and amounts to -if the architecture is i586 set SLKFLAGS to .. if not go to next line.+CFLAGS y CXXFLAGS son variables que contienen valores que pueden ser pasados en tiempo de compilaciónVeremos más tarde que la variable SLKFLAGS se utilizará para establecerlas
  
-CFLAGS and CXXFLAGS are variables holding values that can be passed in at compile time. We will see later that the variable SLKFLAGS will be used to set them.  +Próximo bloque de código:
- +
-Next block of code:+
  
 <code> <code>
Línea 229: Línea 232:
   -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;   -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
 </code> </code>
 +set -e: esto detiene la ejecución del script si hay un error al ejecutar este código siguiendo este comando\\
 +rm -rf $PKG: esto borra algún directorio previo (y contenido) de 
 +rm -rf $PKG: this  deletes any previous directory (and contents) of package-latex2html en /tmp/SBo/package-latex2html \\
  
-set -e: this stops the execution of the script if there is an  error executing this code following this command \\ +package-latex2html at  of /tmp/SBo/package-latex2html \\ 
-rm -rf $PKG: this  deletes any previous directory (and contents)  of   package-latex2html at  of /tmp/SBo/package-latex2html \\ +mkdir -p $TMP $PKG $OUTPUT :mkdir con la bandera (flag) " -p " crea directoriospero sólo si no existen ya.\\
-mkdir -p $TMP $PKG $OUTPUT :mkdir with the " -p " flag creates  directoriesbut only if they don't exist already.\\+
  
-that would be /tmp/SBo , /tmp/Sbo/package-latex2html, /tmp \\+que serían /tmp/SBo , /tmp/Sbo/package-latex2html, /tmp \\
  
 +Es improbable que el directorio SBo no exista a menos que no se hayan ejecutado otros slackbuilds en el pasado. /tmp debería estar ahí por defecto con la instalación de slackware. 
  
-Its  unlikely that the SBo directory doesn't exist unless no other slackbuilds have been run in the past . /tmp should be there as default with the  slackware installation. \\  +cd $tmp : mueve el lugar donde Bash está trabajando de a /tmp/SBo \\
-cd $tmp : moves location where bash is  working from to /tmp/SBo \\+
  
-rm -rf $PRGNAM-$VERSION will get rid of any previous directory entries(maybe failed for latex2html-2019.2  \\+rm -rf $PRGNAM-$VERSION se deshará de cualquier entrada previa del directorio (tal vez fallidapara latex2html-2019.2.\\
  
-tar xvf $CWD/$PRGNAM-$VERSION.tar.gz : This equated to unpacking of  latex2html-2019.2.tar.gz , which would be inside the unpacked slackbuild from slackbuilds.org namely "latex2html".\\+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz : Esto equivalía a desempacar de  latex2html-2019.2.tar.gz , el cual estaría en el interior del slackbuild de slackbuilds.org llamado "latex2html".\\
  
-cd $PRGNAM-$VERSION : This  is a "change directorycommandThe bash shell will now be working from the context that is located inside the unpacked  sourcewhich is located $CWD. i.e We are back to the unpacked slackbuild but, inside the unpacked source.+cd $PRGNAM-$VERSION : Este es el comando para "cambiar de directorio"El shell bash funcionara ahora desde el contexto que se encuentra dentro de la fuente desempacadaque se encuentra en $CWD. Es decir, estamos desempacando el slackbuild pero dentro de la fuente desempacada.
  
-chown -R root:root . : Notice the dot with a space at the end of the linethis means all in current directory. -R is permission recursiveSo here we are giving ownership to root and group root.+chown -R root:root . : Note el puntocon un espacio al final de la líneaesto significa todo en el directorio actual. -R es recursivoAsí que aquí estamos dando propiedad a root y al grupo root.
 <code> <code>
  find -L . \  find -L . \
Línea 255: Línea 260:
 </code> </code>
  
-If i understand the above block of code correctly its using the "findon the basis of permissions and following symbolic links using the "-L flag"If i understand this correctly its basically setting directories to 755 in order to enable a "cd" into them and files so that root can read writeIf this is true I might  have expected+Si entiendo correctamente el bloque de código anterior, está usando la "búsquedaen base a los permisos y siguiendo los enlaces simbólicos usando "-L flag"Si entiendo esto correctamente, es básicamente establecer los directorios 755 para habilitar un "cd" en ellos y los archivos para que root pueda leer y escribirSi esto es cierto, podría haber esperado: 
 <code> <code>
 -type d -exec chmod 775 {}  -type d -exec chmod 775 {} 
 </code>  </code> 
- +Para directorio y
-For directories  and +
 <code> <code>
 -type f -exec chmod 644 {} -type f -exec chmod 644 {}
  
 </code> </code>
-For files+para archivos
-Next block of code+ 
 +Próximo bloque de código
 <code> <code>
 CFLAGS="$SLKCFLAGS" \ CFLAGS="$SLKCFLAGS" \
Línea 288: Línea 294:
 </code> </code>
  
-A couple of things to say here , the use of "\" is a way of using a long command over several lines. We have already mentioned CFLAGS and CXXFLAGS. We also previously mentioned the variable SLKFLAGS and here we use it to set the value of CFLAGS and CXXFLAGS. +Un par de cosas para decir aquí, el uso de "\" es una forma de usar un comando largo sobre varias líneas. Ya se mencionó CFLAGS y CXXFLAGS. 
 +A couple of things to say here , the use of "\" is a way of using a long command over several lines. We have already mentioned CFLAGS and CXXFLAGS. 
 +También hemos mencionado anteriormente la variable SLKFLAGS y aquí la usamos para establecer el valor de CFLAGS CXXFLAGS. 
  
-In this latex2html slackbuild script we also utilize a three step process of configure, make, make install. +En este script slackbuild latex2html también utilizamos un proceso de tres pasos de configurar, make, make install. 
-But what about the likes of  --enable-eps , where does that come from ?+Pero, ¿qué pasa con los tipos de --enable-eps, ¿de dónde viene eso?
  
-Well if you take the source code  [[https://github.com/latex2html/latex2html/archive/v2019.2/latex2html-2019.2.tar.gz | latex2html source]]unpack it a quick way is right click , open with Ark) cd into it and run :+Bueno, si tomas el código fuente de [[https://github.com/latex2html/latex2html/archive/v2019.2/latex2html-2019.2.tar.gz | latex2html source]] desempaquetas una forma rápida es hacer click con el botón derechoabrir con Ark) ingresar al directorio y ejecutar:
  
  
Línea 300: Línea 308:
 </code> </code>
  
-Then you will get some useful information from the developersIt tells you the option and how you can enable some of them+Entonces obtendrá información útil de los desarrolladoresTe dice la opción y cómo puedes habilitar algunas de ellas
  
 <code> <code>
Línea 307: Línea 315:
 </code> </code>
  
-Here, make, make install are carried out.Note DESTDIR is a flag to say where the package will go. \\+Aquí, make, make install se llevan a cabo. Note que DESTDIR es una bandera que indica dónde irá el paquete.\\
    
 $PKG equates to /tmp/SBo/package-latex2html $PKG equates to /tmp/SBo/package-latex2html
  
-Next Block of code:\\+Proximo bloque de código:\\
  
 <code> <code>
Línea 332: Línea 340:
  
 </code> </code>
 +Las dos primeras líneas de este bloque están un poco llenas:
  
-The first two lines of this block are a bit of a mouth-full: 
 <code> <code>
 find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
Línea 339: Línea 347:
 </code> </code>
  
-We can however pick out key words that are commands and that can help to make some sense of it. +Sin embargo, podemos elegir palabras clave que son órdenes y que pueden ayudar a darle algún sentido. "find" es una poderosa utilidad, con más de 50 opciones, localizada en /usr/bin/find. Básicamente hace lo que dice en la lataCon la opción -print0 separa lo que encuentra con "\000"en una palabra NULL.  
-indlocated at /usr/bin/find is a powerful utility  that has around 50 optionsIt basically does what it says on the can.With the -print0 option it separates what it finds with "\000"  in a word NULL. +La tuberia "|" es usada para pasar los resultados de un comando a otro; en este caso xargs tiene un flag (bandera) -0. Esta opción es para que xargs acepte la entrada que tiene /000 entre ellos. ELF es un formato ejecutable y enlazable.
  
-The "|" or pipe is used to pass the results of a command to another;in this case xargs which has a flag -0. This option  is for xargs to accept input that has /000 between them. ELF is is Executable & Linkable Format. +Para dar una respuesta sucinta las dos líneas están eliminando los símbolos de depuración y otras cosas innecesarias para que los binarios sean más pequeñosmás rápidos y ocupen menos memoria.
- +
-To give a succinct answer the two lines are removing debugging symbols and other unnecessary stuff to make the binaries smallerfaster and take up less memory.+
  
 <code> <code>
Línea 350: Línea 356:
 </code> </code>
  
-Here we are preparing a directory which will be called "latex2html-2019.2" located at  /usr/doc. This is so we an put relevant documentation into a directory relevantly calledso that user can access documentation on the package+Aquí estamos preparando un directorio que se llamara "latex2html-2019.2" localizado en /usr/doc. 
-The next lines put files such as  README.md into the /usr/doc/latex2html-2019.2 directory.+Esto es así para que pongamos la documentación relevante en un directorio. De esta formaun usuario puede acceder la documentación del paquete
 +Las siguientes líneas ponen archivos como README.md en el directorio /usr/doc/latex2html-2019.2.
  
 <code> <code>
Línea 357: Línea 364:
 </code> </code>
  
-That line goes back to the original directory that Latex2html.SlackBuild was run from i previously quoted Desktop) opens up the SlackBuild with "cat"  command and copies it to the documentation directory +Esa línea vuelve al directorio original que Latex2html. SlackBuild fue ejecutado desde (yo previamente ingrese al Desktop) abre el SlackBuild con el comando "cat" y lo copia al directorio de documentación.
-Now before I submitted latex2html to slackbuilds obviously I did some testing and found that when the package was installed it had a fairly comprehensive output of what it could do just using: +
  
 +Ahora, antes de enviar latex2html a slackbuilds, obviamente hice algunas pruebas y encontré que cuando el paquete fue instalado tenía una salida bastante completa de lo que podía hacer simplemente usando: 
 <code> <code>
 $ latex2html --help $ latex2html --help
 </code>  </code> 
  
-Also I had access to comprehensive manual in pdf formatso in my case I did not write code for man pagesInstead I simply put a copy of "manual.pdf" into the /usr/doc/latex2html-2019.2 directory.+ 
 +También tuve acceso un completo manual en formato pdf; así que en mi caso no escribí código para las páginas de manualEn su lugar, simplemente puse una copia de "manual.pdf" en el directorio /usr/doc/latex2html-2019.2.
  
  
Línea 370: Línea 378:
  
 //Si enseñas matemáticas no te impide incrustar un poco de inglés.// //Si enseñas matemáticas no te impide incrustar un poco de inglés.//
 +
 Una plantilla en blanco puede ser obtenida de: [[https://slackbuilds.org/templates/]] Una plantilla en blanco puede ser obtenida de: [[https://slackbuilds.org/templates/]]
  
 es:howtos:misc:anatomy_of_a_slackbuild ()