Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
aports
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakub Panek
aports
Commits
dbf9f383
Commit
dbf9f383
authored
10 years ago
by
Timo Teräs
Browse files
Options
Downloads
Patches
Plain Diff
main/musl: add iconv (from noXCUse) and some getconf extensions
parent
23c3500b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
main/musl/APKBUILD
+23
-12
23 additions, 12 deletions
main/musl/APKBUILD
main/musl/getconf.c
+2
-0
2 additions, 0 deletions
main/musl/getconf.c
main/musl/iconv.c
+110
-0
110 additions, 0 deletions
main/musl/iconv.c
with
135 additions
and
12 deletions
main/musl/APKBUILD
+
23
−
12
View file @
dbf9f383
...
...
@@ -2,7 +2,7 @@
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname
=
musl
pkgver
=
1.1.0
pkgrel
=
0
pkgrel
=
1
pkgdesc
=
"the musl c library (libc) implementation"
url
=
"http://www.musl-libc.org/"
arch
=
"all"
...
...
@@ -21,6 +21,7 @@ source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
__stack_chk_fail_local.c
getconf.c
getent.c
iconv.c
"
_builddir
=
"
$srcdir
"
/musl-
$pkgver
...
...
@@ -62,9 +63,11 @@ build() {
${
CROSS_COMPILE
}
gcc
$CPPFLAGS
$CFLAGS
-c
"
$srcdir
"
/__stack_chk_fail_local.c
-o
__stack_chk_fail_local.o
||
return
1
${
CROSS_COMPILE
}
ar r libssp_nonshared.a __stack_chk_fail_local.o
||
return
1
# getconf/getent
${
CROSS_COMPILE
}
gcc
$CPPFLAGS
$CFLAGS
"
$srcdir
"
/getconf.c
-o
getconf
||
return
1
${
CROSS_COMPILE
}
gcc
$CPPFLAGS
$CFLAGS
"
$srcdir
"
/getent.c
-o
getent
||
return
1
# getconf/getent/iconv
local
i
for
i
in
getconf getent iconv
;
do
${
CROSS_COMPILE
}
gcc
$CPPFLAGS
$CFLAGS
"
$srcdir
"
/
$i
.c
-o
$i
||
return
1
done
# note: not autotools
LDFLAGS
=
"
$LDFLAGS
-Wl,-soname,libc.musl-
${
CARCH
}
.so.1"
\
...
...
@@ -97,11 +100,16 @@ package() {
utils
()
{
replaces
=
"uclibc-utils"
license
=
"MIT BSD GPL2+"
mkdir
-p
"
$subpkgdir
"
/usr/bin
"
$subpkgdir
"
/sbin
mv
"
$pkgdir
"
/usr/bin/ldd
"
$subpkgdir
"
/usr/bin
find
"
$pkgdir
"
-type
d
-delete
2>/dev/null
install
-D
"
$_builddir
"
/getent
"
$subpkgdir
"
/usr/bin/getent
install
-D
"
$_builddir
"
/getconf
"
$subpkgdir
"
/usr/bin/getconf
install
-D
\
"
$_builddir
"
/getent
\
"
$_builddir
"
/getconf
\
"
$_builddir
"
/iconv
\
"
$subpkgdir
"
/usr/bin
cat
<<
EOF
> "
$subpkgdir
"/sbin/ldconfig
#!/bin/sh
exit 0
...
...
@@ -120,19 +128,22 @@ a3810683ef61ac27e2f6ec9801280c81 1001-add-basic-dns-record-parsing-functions.pa
83c3bd2a50b1de5ef948704d3f4e0583 1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
61c6c1e84ed1df82abbe6d75e90cf21c getopt_long.c
0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c
7b391300396e58fe9073866b5a80cfe8 getconf.c
2b941c4251cac44988a4abfc50e21267 getent.c"
abf2cfea8e8cbca6a8f76e0cf33bbdf4 getconf.c
2b941c4251cac44988a4abfc50e21267 getent.c
170ce44d0eca4bcfebdf402f21af5f71 iconv.c"
sha256sums
=
"de1b43019e5361d7577e5e0213e9dde591853e9da5d4a7cd75e2e0d78bf60820 musl-1.1.0.tar.gz
758390768b1bc4159d56908ca332b9640cd0552ed3b4b2b8d4a6d499c54c11a1 1001-add-basic-dns-record-parsing-functions.patch
1c25880095e869b827f02997e864fdf4bf157a4e923e52d97dbd05e657aedb70 1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
d9b644ec20bc33e81a7c52b9fcf7973d835923a69faf50f03db45534b811bd96 getopt_long.c
299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c
530ea449f93d53fafcb377fa0a23a7564f2961e49c07a8fdef6c960110317301 getconf.c
68373a55e89ce85c562d941ccf588337d6cc6c9c17689d695f65cd7607134bbe getent.c"
50ad8fa30434cdfc23107a1df1cb3274a6263f3531bc4db870c0a86192507737 getconf.c
68373a55e89ce85c562d941ccf588337d6cc6c9c17689d695f65cd7607134bbe getent.c
c24f1da0bdb201d0689efcf257d2146209cb036c313436d76ca80984ace01b0c iconv.c"
sha512sums
=
"72dab085fa56a2f02d407074b9a4c1d409624df74924ed385b174a767113aa0a4112bd22d3eaf465b31a14b8e60a15997d6042421994673977de306ee8738b3d musl-1.1.0.tar.gz
dad965258daf69371b844f76bfe5a914b0eca0ca76f3fc340b8fd7acf598b5f87bbe6d68b1f43ed0293ee0ed3bfd85d5173ccc169aa6265646248d5b8a906708 1001-add-basic-dns-record-parsing-functions.patch
72cf33738d2cf31f6ec02312bc494d754c17470b519172bb8bd7e2e29ac3b119023088a2b3fbc0dbc2fddd0078ccbae62096106cae361f8c31d6a9950043af25 1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
140f3f20d30bd95ebce8c41b8cc7f616c6cbedf4ea06c729c21014e74f6043796825cc40ebc5180620ea38173afdba23f09ebf6d8b11fa05440b14d23764fca9 getopt_long.c
062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c
d638cdd02371351190fd0545fb83f44b822fa8c930e9fb47ef93d32a1aaee27641f875e10fa2e9833f1a56dfc2055fb89932a89c88da3e2eb17529bca58f5182 getconf.c
b35de9847353b273516162ed4828a810c6130fc5b7de44ee4433003b3f99647b25792d9b1c40dfc67069add11f3fb850e5c35d4f1912dccac108059bbbdfd5a2 getent.c"
2cd55186c01877d50ea2e157633cad44dc49c989b856ae3da6361a040043ff3470bb46354b889e430d618759fcc493db09eeb611ce5211d7a2e92497444a1f38 getconf.c
b35de9847353b273516162ed4828a810c6130fc5b7de44ee4433003b3f99647b25792d9b1c40dfc67069add11f3fb850e5c35d4f1912dccac108059bbbdfd5a2 getent.c
cef7a6c35c909c70f49935cc84d9e675ff7b63979c222e08f3a70e3f7792607c73f28e8048d61c89f34e13b0144e79e374b73d1727419f6b7c98471c2c338077 iconv.c"
This diff is collapsed.
Click to expand it.
main/musl/getconf.c
+
2
−
0
View file @
dbf9f383
...
...
@@ -168,6 +168,8 @@ static const struct conf_variable conf_table[] =
{
"GETPW_R_SIZE_MAX"
,
SYSCONF
,
_SC_GETPW_R_SIZE_MAX
},
/* Commonly provided extensions */
{
"_SC_PHYS_PAGES"
,
SYSCONF
,
_SC_PHYS_PAGES
},
{
"_SC_AVPHYS_PAGES"
,
SYSCONF
,
_SC_AVPHYS_PAGES
},
{
"_NPROCESSORS_CONF"
,
SYSCONF
,
_SC_NPROCESSORS_CONF
},
{
"_NPROCESSORS_ONLN"
,
SYSCONF
,
_SC_NPROCESSORS_ONLN
},
...
...
This diff is collapsed.
Click to expand it.
main/musl/iconv.c
0 → 100644
+
110
−
0
View file @
dbf9f383
/*
* iconv.c
* Implementation of SUSv4 XCU iconv utility
* Copyright © 2011 Rich Felker
* Licensed under the terms of the GNU General Public License, v2 or later
*/
#include
<stdlib.h>
#include
<stdio.h>
#include
<iconv.h>
#include
<locale.h>
#include
<langinfo.h>
#include
<unistd.h>
#include
<errno.h>
#include
<string.h>
int
main
(
int
argc
,
char
**
argv
)
{
const
char
*
from
=
0
,
*
to
=
0
;
int
b
;
iconv_t
cd
;
char
buf
[
BUFSIZ
];
char
outbuf
[
BUFSIZ
*
4
];
char
*
in
,
*
out
;
size_t
inb
;
size_t
l
;
size_t
unitsize
=
0
;
int
err
=
0
;
FILE
*
f
;
while
((
b
=
getopt
(
argc
,
argv
,
"f:t:csl"
))
!=
EOF
)
switch
(
b
)
{
case
'l'
:
puts
(
"UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF32-LE, UCS-2BE, UCS-2LE, WCHAR_T,
\n
"
"US_ASCII, ISO8859-1, ISO8859-2, ISO8859-3, ISO8859-4, ISO8859-5,
\n
"
"ISO8859-6, ISO8859-7, ..."
);
exit
(
0
);
case
'c'
:
case
's'
:
break
;
case
'f'
:
from
=
optarg
;
break
;
case
't'
:
to
=
optarg
;
break
;
default:
exit
(
1
);
}
if
(
!
from
||
!
to
)
{
setlocale
(
LC_CTYPE
,
""
);
if
(
!
to
)
to
=
nl_langinfo
(
CODESET
);
if
(
!
from
)
from
=
nl_langinfo
(
CODESET
);
}
cd
=
iconv_open
(
to
,
from
);
if
(
cd
==
(
iconv_t
)
-
1
)
{
if
(
iconv_open
(
to
,
"WCHAR_T"
)
==
(
iconv_t
)
-
1
)
fprintf
(
stderr
,
"iconv: destination charset %s"
,
to
);
else
fprintf
(
stderr
,
"iconv: source charset %s"
,
from
);
perror
(
""
);
exit
(
1
);
}
if
(
optind
==
argc
)
argv
[
argc
++
]
=
"-"
;
for
(;
optind
<
argc
;
optind
++
)
{
if
(
argv
[
optind
][
0
]
==
'-'
&&
!
argv
[
optind
][
1
])
{
f
=
stdin
;
argv
[
optind
]
=
"(stdin)"
;
}
else
if
(
!
(
f
=
fopen
(
argv
[
optind
],
"rb"
)))
{
fprintf
(
stderr
,
"iconv: %s"
,
argv
[
optind
]);
perror
(
""
);
err
=
1
;
continue
;
}
inb
=
0
;
for
(;;)
{
in
=
buf
;
out
=
outbuf
;
l
=
fread
(
buf
+
inb
,
1
,
sizeof
(
buf
)
-
inb
,
f
);
inb
+=
l
;
if
(
!
inb
)
break
;
if
(
iconv
(
cd
,
&
in
,
&
inb
,
&
out
,
(
size_t
[
1
]){
sizeof
outbuf
})
==-
1
&&
errno
==
EILSEQ
)
{
if
(
!
unitsize
)
{
wchar_t
wc
=
'0'
;
char
dummy
[
4
],
*
dummyp
=
dummy
;
iconv_t
cd2
=
iconv_open
(
from
,
"WCHAR_T"
);
if
(
cd
==
(
iconv_t
)
-
1
)
{
unitsize
=
1
;
}
else
{
iconv
(
cd2
,
(
char
*
[
1
]){(
char
*
)
&
wc
},
(
size_t
[
1
]){
1
},
&
dummyp
,
(
size_t
[
1
]){
4
});
unitsize
=
dummyp
-
dummy
;
if
(
!
unitsize
)
unitsize
=
1
;
}
}
inb
-=
unitsize
;
in
+=
unitsize
;
}
if
(
inb
&&
!
l
&&
errno
==
EINVAL
)
break
;
if
(
out
>
outbuf
&&
!
fwrite
(
outbuf
,
out
-
outbuf
,
1
,
stdout
))
{
perror
(
"iconv: write error"
);
exit
(
1
);
}
if
(
inb
)
memmove
(
buf
,
in
,
inb
);
}
if
(
ferror
(
f
))
{
fprintf
(
stderr
,
"iconv: %s"
,
argv
[
optind
]);
perror
(
""
);
err
=
1
;
}
}
return
err
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment